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];
165#if QT_CONFIG(tabwidget)
189 switch (tabWidget->tabPosition()) {
191 tabBarRect.
setY(tabBarRect.
y() + tabBarRect.
height() / 2);
195 tabBarRect = tabBarRect.
adjusted(0, 2, 0, -2);
198 tabBarRect = tabBarRect.
adjusted(tabBarRect.
width() / 2, 2, tabBarRect.
width() / 2, -2);
202 QVarLengthArray<CGRect, 3> cgRects;
203 for (
const QRect &qtRect : clipPath)
204 cgRects.push_back(qtRect.toCGRect());
206 CGContextClipToRects(
ctx, &cgRects[0],
size_t(cgRects.size()));
234static const QColor lightTabBarTabBackgroundActive(190, 190, 190);
235static const QColor darkTabBarTabBackgroundActive(38, 38, 38);
236static const QColor tabBarTabBackgroundActive() {
return isDarkMode() ? darkTabBarTabBackgroundActive : lightTabBarTabBackgroundActive; }
238static const QColor lightTabBarTabBackgroundActiveHovered(178, 178, 178);
239static const QColor darkTabBarTabBackgroundActiveHovered(32, 32, 32);
240static const QColor tabBarTabBackgroundActiveHovered() {
return isDarkMode() ? darkTabBarTabBackgroundActiveHovered : lightTabBarTabBackgroundActiveHovered; }
242static const QColor lightTabBarTabBackgroundActiveSelected(211, 211, 211);
243static const QColor darkTabBarTabBackgroundActiveSelected(52, 52, 52);
244static const QColor tabBarTabBackgroundActiveSelected() {
return isDarkMode() ? darkTabBarTabBackgroundActiveSelected : lightTabBarTabBackgroundActiveSelected; }
246static const QColor lightTabBarTabBackground(227, 227, 227);
247static const QColor darkTabBarTabBackground(38, 38, 38);
248static const QColor tabBarTabBackground() {
return isDarkMode() ? darkTabBarTabBackground : lightTabBarTabBackground; }
250static const QColor lightTabBarTabBackgroundSelected(246, 246, 246);
251static const QColor darkTabBarTabBackgroundSelected(52, 52, 52);
252static const QColor tabBarTabBackgroundSelected() {
return isDarkMode() ? darkTabBarTabBackgroundSelected : lightTabBarTabBackgroundSelected; }
254static const QColor lightTabBarTabLineActive(160, 160, 160);
255static const QColor darkTabBarTabLineActive(90, 90, 90);
256static const QColor tabBarTabLineActive() {
return isDarkMode() ? darkTabBarTabLineActive : lightTabBarTabLineActive; }
258static const QColor lightTabBarTabLineActiveHovered(150, 150, 150);
259static const QColor darkTabBarTabLineActiveHovered(90, 90, 90);
260static const QColor tabBarTabLineActiveHovered() {
return isDarkMode() ? darkTabBarTabLineActiveHovered : lightTabBarTabLineActiveHovered; }
262static const QColor lightTabBarTabLine(210, 210, 210);
263static const QColor darkTabBarTabLine(90, 90, 90);
264static const QColor tabBarTabLine() {
return isDarkMode() ? darkTabBarTabLine : lightTabBarTabLine; }
266static const QColor lightTabBarTabLineSelected(189, 189, 189);
267static const QColor darkTabBarTabLineSelected(90, 90, 90);
268static const QColor tabBarTabLineSelected() {
return isDarkMode() ? darkTabBarTabLineSelected : lightTabBarTabLineSelected; }
270static const QColor tabBarCloseButtonBackgroundHovered(162, 162, 162);
271static const QColor tabBarCloseButtonBackgroundPressed(153, 153, 153);
272static const QColor tabBarCloseButtonBackgroundSelectedHovered(192, 192, 192);
273static const QColor tabBarCloseButtonBackgroundSelectedPressed(181, 181, 181);
274static const QColor tabBarCloseButtonCross(100, 100, 100);
275static const QColor tabBarCloseButtonCrossSelected(115, 115, 115);
277static const int closeButtonSize = 14;
278static const qreal closeButtonCornerRadius = 2.0;
281#if QT_CONFIG(accessibility)
288 return isOnKeyWindow ?
QColor(73, 73, 73, 100) :
QColor(56, 56, 56, 100);
290 return isOnKeyWindow ?
QColor(0, 0, 0, 28) :
QColor(0, 0, 0, 21);
302 { 0.5, 1.5, 2.5, 3.5 }
307 { 0.5, -1.5, 0.5, 2.5 },
312 { 1.5, -1.5, 1.5, 4.5 },
314 { 1.5, 0.5, 1.5, 2.5 }
351 auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name;
352 if (![NSAppearance.currentAppearance.name isEqualToString:requiredAppearanceName]) {
353 previous = NSAppearance.currentAppearance;
354 NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName];
362 NSAppearance.currentAppearance = previous;
366 NSAppearance *previous = nil;
373 const qreal length = sb->maximum - sb->minimum + sb->pageStep;
382 scroller.frame = sb->rect.toCGRect();
384 scroller.knobProportion = proportion;
388static bool setupSlider(NSSlider *slider,
const QStyleOptionSlider *sl)
390 if (sl->minimum >= sl->maximum)
393 slider.frame = sl->rect.toCGRect();
395 slider.minValue = sl->minimum;
396 slider.maxValue = sl->maximum;
397 slider.intValue = sl->sliderPosition;
401 int interval = sl->tickInterval;
403 interval = sl->pageStep;
405 interval = sl->singleStep;
409 slider.numberOfTickMarks = 1 + ((sl->maximum - sl->minimum) / interval);
413 slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionAbove : NSTickMarkPositionBelow;
415 slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionLeading : NSTickMarkPositionTrailing;
417 slider.numberOfTickMarks = 0;
422 [slider layoutSubtreeIfNeeded];
435 typedef bool (*TestContentBorderPositionFunction)(
QWindow *, int);
436 return (
reinterpret_cast<TestContentBorderPositionFunction
>(function))(
window, windowY);
441static void drawTabCloseButton(
QPainter *
p,
bool hover,
bool selected,
bool pressed,
bool documentMode)
444 QRect rect(0, 0, closeButtonSize, closeButtonSize);
453 background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
455 background =
QColor(255, 255, 255, pressed ? 150 : 100);
457 background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered;
459 background = background.
lighter(pressed ? 135 : 140);
463 p->setBrush(background);
464 p->drawRoundedRect(
rect, closeButtonCornerRadius, closeButtonCornerRadius);
468 const int margin = 3;
470 crossPen.
setColor(selected ? (documentMode ? tabBarCloseButtonCrossSelected :
Qt::
white) : tabBarCloseButtonCross);
471 crossPen.setWidthF(1.1);
474 p->drawLine(margin, margin,
width - margin,
height - margin);
475 p->drawLine(margin,
height - margin,
width - margin, margin);
480 const auto tabDirection = QMacStylePrivate::tabDirection(shape);
481 if (QMacStylePrivate::verticalTabs(tabDirection)) {
482 int newX, newY, newRot;
484 newX = tabRect.
width();
489 newY = tabRect.
y() + tabRect.
height();
504 if (QMacStylePrivate::verticalTabs(QMacStylePrivate::tabDirection(tabOpt->shape)))
507 rect =
rect.adjusted(0, -tabOverlap, 0, 0);
524 if (tabOpt->documentMode && isUnified) {
530 p->fillRect(bodyRect, tabBarTabBackgroundActiveSelected());
532 p->fillRect(topLineRect, tabBarTabLineSelected());
534 p->fillRect(bodyRect, tabBarTabBackgroundSelected());
541 p->fillRect(bodyRect, tabBarTabBackgroundActiveHovered());
550 const QColor separatorLineColor = active ? tabBarTabLineActive() : tabBarTabLine();
551 p->fillRect(leftLineRect, separatorLineColor);
552 p->fillRect(rightLineRect, separatorLineColor);
558 if (QMacStylePrivate::verticalTabs(QMacStylePrivate::tabDirection(tbb->shape)))
561 r.setHeight(
w->height());
570 const QColor bodyColor = active ? tabBarTabBackgroundActive() : tabBarTabBackground();
571 p->fillRect(bodyRect, bodyColor);
575 const QColor topLineColor = active ? tabBarTabLineActive() : tabBarTabLine();
576 p->fillRect(topLineRect, topLineColor);
580 bool isDocument =
false;
581 if (
const QTabBar *tabBar = qobject_cast<const QTabBar*>(
w))
582 isDocument = tabBar->documentMode();
584 p->fillRect(bottomLineRect, bottomLineColor);
597#if QT_CONFIG(treeview)
610 int l = original.
length();
617 }
else if (original.
at(currPos) ==
QLatin1Char(
'(') && l >= 4 &&
623 while (finalDest >
n && returnText.at(finalDest -
n - 1).isSpace())
630 returnText[finalDest] = original.
at(currPos);
635 returnText.truncate(finalDest);
644 return [nswindow isMainWindow];
760 qDebug(
"Not sure how to return this...");
774#if QT_CONFIG(pushbutton)
775 if (qobject_cast<const QPushButton *>(widg))
778 else if (qobject_cast<const QRadioButton *>(widg))
780#if QT_CONFIG(checkbox)
781 else if (qobject_cast<const QCheckBox *>(widg))
784#if QT_CONFIG(combobox)
785 else if (qobject_cast<const QComboBox *>(widg))
788#if QT_CONFIG(toolbutton)
789 else if (qobject_cast<const QToolButton *>(widg))
792 else if (qobject_cast<const QSlider *>(widg))
794#if QT_CONFIG(progressbar)
795 else if (qobject_cast<const QProgressBar *>(widg))
798#if QT_CONFIG(lineedit)
799 else if (qobject_cast<const QLineEdit *>(widg))
802#if QT_CONFIG(itemviews)
803 else if (qobject_cast<const QHeaderView *>(widg))
806#if QT_CONFIG(menubar)
807 else if (qobject_cast<const QMenuBar *>(widg))
810#if QT_CONFIG(sizegrip)
811 else if (qobject_cast<const QSizeGrip *>(widg))
819#if QT_CONFIG(pushbutton)
857 if (rdo->text().find(
'\n') != -1)
880#if QT_CONFIG(mdiarea)
881 if (widg && qobject_cast<QMdiSubWindow *>(widg->parentWidget()))
905 if (szHint ==
QSize(-1, -1)) {
906#if QT_CONFIG(toolbutton)
910 if (!bt->icon.isNull()) {
917 int text_width = bt->fontMetrics.horizontalAdvance(bt->text),
918 text_height = bt->fontMetrics.height();
945 const QStyleOptionSlider *sld = qstyleoption_cast<const QStyleOptionSlider *>(
opt);
953 else if (isBigSurOrAbove)
995#if QT_CONFIG(progressbar)
999 if (
const QProgressBar *pb = qobject_cast<const QProgressBar *>(widg))
1000 orient = pb->orientation();
1009 ret.setHeight(finalValue);
1011 ret.setWidth(finalValue);
1015#if QT_CONFIG(combobox)
1017 if (!widg || !qobject_cast<QComboBox *>(widg->parentWidget())) {
1027#if QT_CONFIG(treeview)
1028 if (isTreeView(widg))
1034 ret =
QSize(-1, [[NSApp mainMenu] menuBarHeight]);
1039 if (
ret.height() <= 0)
1050#if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
1055 if (large ==
QSize(-1, -1)) {
1056 if (small !=
QSize(-1, -1))
1058 if (mini !=
QSize(-1, -1))
1061 }
else if (small ==
QSize(-1, -1)) {
1062 if (mini !=
QSize(-1, -1))
1065 }
else if (mini ==
QSize(-1, -1)) {
1085 qreal hOffset = 0.0;
1086 qreal vOffset = 0.0;
1089 case Button_SquareButton:
1090 case SegmentedControl_Middle:
1092 auto innerRect = targetRect;
1093 if (
cw.type == Button_SquareButton)
1095 if (
cw.type == TextField)
1099 focusRingPath.addRect(innerRect);
1100 focusRingPath.addRoundedRect(outerRect, outerRadius, outerRadius);
1103 case Button_CheckBox: {
1109 vOffset = 0.5 *
qreal(targetRect.height() - cbSize);
1110 const auto cbInnerRect =
QRectF(0, 0, cbSize, cbSize);
1113 focusRingPath.addRoundedRect(cbOuterRect, cbOuterRadius, cbOuterRadius);
1114 focusRingPath.addRoundedRect(cbInnerRect, cbInnerRadius, cbInnerRadius);
1117 case Button_RadioButton: {
1122 vOffset = 0.5 *
qreal(targetRect.height() - rbSize);
1123 const auto rbInnerRect =
QRectF(0, 0, rbSize, rbSize);
1125 focusRingPath.addEllipse(rbInnerRect);
1126 focusRingPath.addEllipse(rbOuterRect);
1129 case Button_PullDown:
1130 case Button_PushButton: {
1132 auto *pb =
static_cast<NSButton *
>(cocoaControl(
cw));
1134 pb.frame = frameRect.toCGRect();
1135 focusRect = QRectF::fromCGRect([pb alignmentRectForFrame:pb.frame]);
1139 focusRect.adjust(0, 3, 0, -3);
1144 focusRect = focusRect.adjusted(0, 0, 0, -1);
1146 focusRect = focusRect.adjusted(0, -1, 0, 0);
1148 if (isBigSurOrAbove)
1149 focusRect = focusRect.translated(0, 1);
1150 const qreal innerRadius =
cw.type == Button_PushButton ? 3 : 4;
1152 hOffset = focusRect.left();
1153 vOffset = focusRect.top();
1154 const auto innerRect = focusRect.translated(-focusRect.topLeft());
1156 focusRingPath.addRoundedRect(innerRect, innerRadius, innerRadius);
1157 focusRingPath.addRoundedRect(outerRect, outerRadius, outerRadius);
1160 case Button_PopupButton:
1161 case SegmentedControl_Single: {
1162 QRectF focusRect = targetRect;
1163 if (isBigSurOrAbove)
1166 focusRect.adjust(0, 0, 0, -1);
1167 const qreal innerRadius =
cw.type == Button_PushButton ? 3 : 4;
1169 hOffset = focusRect.left();
1170 vOffset = focusRect.top();
1171 const auto innerRect = focusRect.translated(-focusRect.topLeft());
1173 focusRingPath.addRoundedRect(innerRect, innerRadius, innerRadius);
1174 focusRingPath.addRoundedRect(outerRect, outerRadius, outerRadius);
1178 case SegmentedControl_First:
1179 case SegmentedControl_Last: {
1180 hOffset = targetRect.left();
1181 vOffset = targetRect.top();
1182 const qreal innerRadius = 8;
1184 const auto innerRect = targetRect.translated(-targetRect.topLeft());
1191 const auto topLeftCorner =
QRectF(
rect.topLeft(),
QSizeF(tRadius, tRadius));
1192 path.arcMoveTo(topLeftCorner, 180);
1193 path.arcTo(topLeftCorner, 180, -90);
1197 const auto rightEdge =
rect.right() - bRadius;
1198 path.arcTo(rightEdge,
rect.top(), bRadius, bRadius, 90, -90);
1199 path.arcTo(rightEdge,
rect.bottom() - bRadius, bRadius, bRadius, 0, -90);
1201 path.arcTo(
rect.left(),
rect.bottom() - tRadius, tRadius, tRadius, 270, -90);
1204 path.closeSubpath();
1209 const auto innerPath = cbFocusFramePath(innerRect, 0, innerRadius);
1210 focusRingPath.addPath(innerPath);
1211 const auto outerPath = cbFocusFramePath(outerRect, 2 *
focusRingWidth, outerRadius);
1212 focusRingPath.addPath(outerPath);
1219 auto focusRingColor =
qt_mac_toQColor(NSColor.keyboardFocusIndicatorColor.CGColor);
1224 focusRingColor.setAlphaF(0.39);
1230 if (
cw.type == SegmentedControl_First) {
1233 p->translate(hOffset, vOffset);
1234 p->fillPath(focusRingPath, focusRingColor);
1240 static const qreal CornerPointOffset = 5.5;
1241 static const qreal CornerControlOffset = 2.1;
1245 path.moveTo(
r.left(),
r.top() + CornerPointOffset);
1246 path.cubicTo(
r.left(),
r.top() + CornerControlOffset,
1247 r.left() + CornerControlOffset,
r.top(),
1248 r.left() + CornerPointOffset,
r.top());
1250 path.lineTo(
r.right() - CornerPointOffset,
r.top());
1251 path.cubicTo(
r.right() - CornerControlOffset,
r.top(),
1252 r.right(),
r.top() + CornerControlOffset,
1253 r.right(),
r.top() + CornerPointOffset);
1255 path.lineTo(
r.right(),
r.bottom() - CornerPointOffset);
1256 path.cubicTo(
r.right(),
r.bottom() - CornerControlOffset,
1257 r.right() - CornerControlOffset,
r.bottom(),
1258 r.right() - CornerPointOffset,
r.bottom());
1260 path.lineTo(
r.left() + CornerPointOffset,
r.bottom());
1261 path.cubicTo(
r.left() + CornerControlOffset,
r.bottom(),
1262 r.left(),
r.bottom() - CornerControlOffset,
1263 r.left(),
r.bottom() - CornerPointOffset);
1264 path.lineTo(
r.left(),
r.top() + CornerPointOffset);
1271 struct WindowButtons {
1276 static const WindowButtons buttons[] = {
1282 for (
const auto &wb : buttons)
1290#if QT_CONFIG(tabbar)
1301 tr.setRect(0, 0,
tr.height(),
tr.width());
1305 const int hpadding = 4;
1308 verticalShift = -verticalShift;
1309 tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
1312 if (!
opt->leftButtonSize.isEmpty()) {
1313 const int buttonSize =
verticalTabs ?
opt->leftButtonSize.height() :
opt->leftButtonSize.width();
1314 tr.setLeft(
tr.left() + 4 + buttonSize);
1316 if (
opt->rightButtonSize.isEmpty())
1317 tr.setRight(
tr.right() - 4 - buttonSize);
1320 if (!
opt->rightButtonSize.isEmpty()) {
1321 const int buttonSize =
verticalTabs ?
opt->rightButtonSize.height() :
opt->rightButtonSize.width();
1322 tr.setRight(
tr.right() - 4 - buttonSize);
1324 if (
opt->leftButtonSize.isEmpty())
1325 tr.setLeft(
tr.left() + 4 + buttonSize);
1343 if (
opt->documentMode) {
1345 const int textWidth =
1347 *iconRect =
QRect(
tr.center().x() - textWidth / 2 - stylePadding - tabIconSize.width(),
1348 tr.center().y() - tabIconSize.height() / 2,
1349 tabIconSize.width(), tabIconSize.height());
1351 *iconRect =
QRect(
tr.left() + stylePadding,
tr.center().y() - tabIconSize.height() / 2,
1352 tabIconSize.width(), tabIconSize.height());
1357 tr.setLeft(
tr.left() + stylePadding + tabIconSize.width() + 4);
1358 tr.setRight(
tr.right() - stylePadding - tabIconSize.width() - 4);
1407#if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
1428 bool guess_size =
false;
1442 QSize *sz =
nullptr;
1450 *insz = sz ? *sz :
QSize(-1, -1);
1451#ifdef DEBUG_SIZE_CONSTRAINT
1453 const char *size_desc =
"Unknown";
1455 size_desc =
"Small";
1456 else if (sz == &large)
1457 size_desc =
"Large";
1458 else if (sz == &mini)
1460 qDebug(
"%s - %s: %s taken (%d, %d) [%d, %d]",
1461 widg ? widg->objectName().toLatin1().constData() :
"*Unknown*",
1462 widg ? widg->metaObject()->className() :
"*Unknown*", size_desc, widg->width(), widg->height(),
1479 return ((
cw.type << 2) |
cw.size) ^
seed;
1520 const auto frameSize = defaultFrameSize();
1524 .adjusted(-6.5, 0, 6.5, 0);
1532 frameRect = frameRect.
adjusted(0, 0, -8, 0).translated(4, -0.5);
1542 frameRect = frameRect.
adjusted(0, 0, -6, 0).translated(3, 0);
1544 frameRect = frameRect.
adjusted(0, 0, -4, 0).translated(2, 1);
1546 frameRect = frameRect.
adjusted(0, 0, -9, 0).translated(5, 0);
1551 frameRect = frameRect.
adjusted(0, 0, -6, 0).translated(4, 0);
1588 *buttonType = NSButtonTypeSwitch;
1589 *bezelStyle = NSBezelStyleRegularSquare;
1592 *buttonType = NSButtonTypeOnOff;
1593 *bezelStyle = NSBezelStyleDisclosure;
1596 *buttonType = NSButtonTypeRadio;
1597 *bezelStyle = NSBezelStyleRegularSquare;
1600 *buttonType = NSButtonTypePushOnPushOff;
1601 *bezelStyle = NSBezelStyleShadowlessSquare;
1604 *buttonType = NSButtonTypeMomentaryPushIn;
1605 *bezelStyle = NSBezelStyleRounded;
1616 if (
const auto *
btn = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
1632 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
1633 if (combo->editable)
1648 CGRect innerBounds = outerBounds;
1653 switch (cocoaWidget.size) {
1655 innerBounds.origin.x += 3;
1656 innerBounds.origin.y += 3;
1657 innerBounds.size.width -= 6;
1658 innerBounds.size.height -= 7;
1661 innerBounds.origin.x += 2;
1662 innerBounds.origin.y += 2;
1663 innerBounds.size.width -= 5;
1664 innerBounds.size.height -= 6;
1668 innerBounds.origin.x += 2;
1669 innerBounds.origin.y += 2;
1670 innerBounds.size.width -= 5;
1671 innerBounds.size.height -= 6;
1673 }
else if (cocoaWidget.type ==
ComboBox) {
1674 switch (cocoaWidget.size) {
1676 innerBounds.origin.x += 3;
1677 innerBounds.origin.y += 3;
1678 innerBounds.size.width -= 7;
1679 innerBounds.size.height -= 8;
1682 innerBounds.origin.x += 3;
1683 innerBounds.origin.y += 3;
1684 innerBounds.size.width -= 4;
1685 innerBounds.size.height -= 8;
1689 innerBounds.origin.x += 3;
1690 innerBounds.origin.y += 2;
1691 innerBounds.size.width -= 6;
1692 innerBounds.size.height -= 8;
1713 ret =
ret.adjusted(0, 0, -22, 0).translated(2, 3);
1717 ret =
ret.adjusted(0, 0, -19, 0).translated(2, 2.5);
1718 ret.setHeight(10.5);
1726 ret.adjust(10, 1, -23, -4);
1729 ret.adjust(10, 4, -20, -3);
1732 ret.adjust(9, 0, -19, 0);
1771 NSBox *
box = [[NSBox alloc] init];
1774 box.titlePosition = NSNoTitle;
1785 NSButton *bc = [[NSButton alloc] init];
1793 NSPopUpButton *bc = [[NSPopUpButton alloc] init];
1803 const NSWindowButton
button = [=] {
1806 return NSWindowCloseButton;
1808 return NSWindowMiniaturizeButton;
1810 return NSWindowZoomButton;
1816 const auto styleMask = NSWindowStyleMaskTitled
1817 | NSWindowStyleMaskClosable
1818 | NSWindowStyleMaskMiniaturizable
1819 | NSWindowStyleMaskResizable;
1820 bv = [NSWindow standardWindowButton:button forStyleMask:styleMask];
1825 bv = [[NSComboBox alloc] init];
1828 bv = [[NSProgressIndicator alloc] init];
1834 bv = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
1839 bv = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
1842 bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
1847 bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
1850 bv = [[NSSplitView alloc] init];
1856 bv = [[NSTextField alloc] init];
1862 if ([bv isKindOfClass:[NSControl class]]) {
1863 auto *ctrl =
static_cast<NSControl *
>(bv);
1866 ctrl.controlSize = NSControlSizeSmall;
1869 ctrl.controlSize = NSControlSizeMini;
1876 auto *pi =
static_cast<NSProgressIndicator *
>(bv);
1880 pi.controlSize = NSControlSizeSmall;
1883 pi.controlSize = NSControlSizeMini;
1893 NSButtonType buttonType;
1894 NSBezelStyle bezelStyle;
1895 if (
widget.getCocoaButtonTypeAndBezelStyle(&buttonType, &bezelStyle)) {
1898 auto *
button =
static_cast<NSButton *
>(bv);
1899 button.buttonType = buttonType;
1900 button.bezelStyle = bezelStyle;
1902 button.allowsMixedState = YES;
1914 cell = [[NSStepperCell alloc] init];
1917 NSButtonCell *bc = [[NSButtonCell alloc] init];
1918 bc.buttonType = NSButtonTypeOnOff;
1919 bc.bezelStyle = NSBezelStyleDisclosure;
1929 cell.controlSize = NSControlSizeSmall;
1932 cell.controlSize = NSControlSizeMini;
1945 __attribute__((noescape)) DrawRectBlock drawRectBlock)
const
1959 view.wantsLayer = YES;
1977 const CGRect dirtyRect =
rect.toCGRect();
1980 drawRectBlock(
ctx, dirtyRect);
1982 [view drawRect:dirtyRect];
1984 [view removeFromSuperviewWithoutNeedingDisplay];
2000 NSPreferredScrollerStyleDidChangeNotification, []() {
2014 for (NSView *
b :
d->cocoaControls)
2016 d->cocoaControls.clear();
2042 d->smallSystemFont = *ssf;
2044 d->smallSystemFont =
QFont();
2049 || qobject_cast<QMenu*>(
w)
2051 || qobject_cast<QComboBoxPrivateContainer *>(
w)
2055 || qobject_cast<QMdiSubWindow *>(
w)
2059 w->setAutoFillBackground(
false);
2062#if QT_CONFIG(tabbar)
2063 if (
QTabBar *tb = qobject_cast<QTabBar*>(
w)) {
2064 if (tb->documentMode()) {
2078 if (
QRubberBand *rubber = qobject_cast<QRubberBand*>(
w)) {
2079 rubber->setWindowOpacity(0.25);
2084 if (qobject_cast<QScrollBar*>(
w)) {
2087 w->setMouseTracking(
true);
2095 qobject_cast<QMenu*>(
w) &&
2100 w->setWindowOpacity(1.0);
2103#if QT_CONFIG(combobox)
2104 if (
QComboBox *combo = qobject_cast<QComboBox *>(
w)) {
2105 if (!combo->isEditable()) {
2112#if QT_CONFIG(tabbar)
2113 if (qobject_cast<QTabBar*>(
w)) {
2121 if (
QRubberBand *rubber = qobject_cast<QRubberBand*>(
w)) {
2122 rubber->setWindowOpacity(1.0);
2132 if (qobject_cast<QScrollBar*>(
w)) {
2135 w->setMouseTracking(
false);
2146#if QT_CONFIG(tabbar)
2149 ret = closeButtonSize;
2196#if QT_CONFIG(mainwindow)
2200 && qobject_cast<const QAbstractScrollArea *>(
widget))
2205 if (qstyleoption_cast<const QStyleOptionComboBox *>(
opt) != 0)
2230 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
2231 int space = (sl->orientation ==
Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
2232 int ticks = sl->tickPosition;
2249 thick += (space * 2) / (
n + 2);
2273 style |= NSWindowStyleMaskUtilityWindow;
2274 ret = int([NSWindow frameRectForContentRect:NSZeroRect
2275 styleMask:style].size.height);
2289#if QT_CONFIG(tabbar)
2290 const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(
opt);
2291 if (tb && tb->documentMode)
2328 ret =
static_cast<int>([NSScroller
2329 scrollerWidthForControlSize:static_cast<NSControlSize>(size)
2330 scrollerStyle:[NSScroller preferredScrollerStyle]]);
2503 if (
styleNames.toStringList().contains(
"macOS"))
2573 NSUserDefaults*
defaults = [NSUserDefaults standardUserDefaults];
2574 bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
2575 const QStyleOptionSlider *sliderOpt = qstyleoption_cast<const QStyleOptionSlider*>(
opt);
2614#if QT_CONFIG(tabbar)
2615 if (
const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
2625 ret = !cmb->editable;
2639#if QT_CONFIG(tabwidget)
2640 if (
const QTabWidget *tab = qobject_cast<const QTabWidget*>(
w)) {
2641 if (tab->documentMode()) {
2647#if QT_CONFIG(tabbar)
2648 if (
const QTabBar *tab = qobject_cast<const QTabBar*>(
w)) {
2649 if (tab->documentMode()) {
2672 const uchar fillR = 192, fillG = 191, fillB = 190;
2676 if (!pixmapSize.isEmpty()) {
2687 const int w = sbpl/4,
h =
img.height();
2690 QRgb *dptr = (
QRgb*)img_mask.bits(), *drow;
2691 const qsizetype dbpl = img_mask.bytesPerLine();
2693 for (
int y = 0;
y <
h; ++
y) {
2694 srow = sptr+((
y*sbpl)/4);
2695 drow = dptr+((
y*dbpl)/4);
2696 for (
int x = 0;
x <
w; ++
x) {
2697 const int redDiff =
qRed(*srow) - fillR;
2698 const int greenDiff =
qGreen(*srow) - fillG;
2699 const int blueDiff =
qBlue(*srow) - fillB;
2700 const int diff = (redDiff * redDiff) + (greenDiff * greenDiff) + (blueDiff * blueDiff);
2701 (*drow++) = (diff < 10) ? 0xffffffff : 0xff000000;
2736#if QT_CONFIG(dialogbuttonbox)
2771#if QT_CONFIG(wizard)
2788#if QT_CONFIG(tabbar)
2797 if ((qobject_cast<const QScrollBar *>(
w) &&
w->parent() &&
2798 qobject_cast<QAbstractScrollArea*>(
w->parent()->parent()))
2803 ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay;
2806#if QT_CONFIG(itemviews)
2841 int imgw =
img.width();
2843 for (
int y = 0;
y < imgh; ++
y) {
2844 for (
int x = 0;
x < imgw; ++
x) {
2845 pixel =
img.pixel(
x,
y);
2867 static bool recursionGuard =
false;
2872 recursionGuard =
true;
2874 recursionGuard =
false;
2897 QWindow *
window =
w &&
w->window() ?
w->window()->windowHandle() :
nullptr;
2898 d->resolveCurrentNSView(
window);
2906 const int xOffset = 1;
2908 const qreal penWidth =
qMax(halfSize / 3.0, 1.25);
2909#if QT_CONFIG(toolbutton)
2910 if (
const QToolButton *tb = qobject_cast<const QToolButton *>(
w)) {
2914 halfSize -= penWidth;
2937 path.moveTo(-halfSize, -halfSize * 0.5);
2938 path.lineTo(0.0, halfSize * 0.5);
2939 path.lineTo(halfSize, -halfSize * 0.5);
2943 p->strokePath(
path, arrowPen);
2946#if QT_CONFIG(tabbar)
2948 if (
const QStyleOptionTabBarBase *tbb
2949 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
2950 if (tbb->documentMode) {
2952 drawTabBase(
p, tbb,
w);
2956#if QT_CONFIG(tabwidget)
2958 region -= tbb->tabBarRect.adjusted(3, 0, -3, 0);
2960 p->setClipRegion(region);
2961 QStyleOptionTabWidgetFrame twf;
2962 twf.QStyleOption::operator=(*tbb);
2963 twf.shape = tbb->shape;
2964 switch (QMacStylePrivate::tabDirection(twf.shape)) {
2966 twf.rect = twf.rect.adjusted(0, 0, 0, 10);
2969 twf.rect = twf.rect.adjusted(0, -10, 0, 0);
2972 twf.rect = twf.rect.adjusted(0, 0, 10, 0);
2975 twf.rect = twf.rect.adjusted(0, -10, 0, 0);
2988 if (
const auto *
groupBox = qstyleoption_cast<const QStyleOptionFrame *>(
opt))
2993#if QT_CONFIG(tabwidget)
2999 auto *
box =
static_cast<NSBox *
>(
d->cocoaControl(
cw));
3013 auto adjustedRect =
opt->
rect;
3014 bool needTranslation =
false;
3028 adjustedRect.
adjust(0, 0, 6, 6);
3029 needTranslation =
true;
3032#if QT_CONFIG(tabwidget)
3034 clipTabBarFrame(
opt,
this,
ctx);
3036 CGContextTranslateCTM(
ctx, 0,
rect.origin.y +
rect.size.height);
3037 CGContextScaleCTM(
ctx, 1, -1);
3040 [box drawRect:rect];
3042 if (needTranslation)
3043 CGContextTranslateCTM(
ctx, -3.0, 5.0);
3044 [box displayRectIgnoringOpacity:box.bounds inContext:NSGraphicsContext.currentContext];
3062 theStroker.setDashPattern(QVector<qreal>() << 1 << 2);
3063 path = theStroker.createStroke(
path);
3066 p->fillPath(
path, dark);
3071 if (qobject_cast<const QMdiSubWindow*>(
w)) {
3084 p->setPen(
QColor(160, 160, 160));
3087 p->setPen(
QColor(145, 145, 145));
3097 static const int RectHeight = 2;
3099 while (y < opt->
rect.height() - RectHeight - 5) {
3101 path.addEllipse(
x,
y, RectHeight, RectHeight);
3105 while (x < opt->
rect.width() - RectHeight - 5) {
3107 path.addEllipse(
x,
y, RectHeight, RectHeight);
3114 p->fillPath(
path, dark);
3135 QCFType<CGColorRef> checkmarkColor = CGColorCreateGenericRGB(
static_cast<CGFloat>(pc.
redF()),
3146 kCTFontUIFontMenuItemMark;
3151 QCFType<CTFontRef> checkmarkFont = CTFontCreateUIFontForLanguage(
fontType,
fontSize, NULL);
3153 CGContextSaveGState(cg);
3154 CGContextSetShouldSmoothFonts(cg, NO);
3162 CGContextScaleCTM(cg, 1, -1);
3164 CGContextTranslateCTM(cg,
opt->
rect.
x(), vOffset);
3168 static const CFStringRef
keys[] = { kCTFontAttributeName, kCTForegroundColorAttributeName };
3169 static const int numValues =
sizeof(
keys) /
sizeof(
keys[0]);
3170 const CFTypeRef
values[] = { (CFTypeRef)checkmarkFont, (CFTypeRef)checkmarkColor };
3171 static_assert((
sizeof(
values) /
sizeof(
values[0])) == numValues);
3172 QCFType<CFDictionaryRef> attributes = CFDictionaryCreate(kCFAllocatorDefault, (
const void **)
keys, (
const void **)
values,
3173 numValues, NULL, NULL);
3175 QCFType<CFAttributedStringRef> checkmarkString = CFAttributedStringCreate(kCFAllocatorDefault, (CFStringRef)
@"\u2713", attributes);
3176 QCFType<CTLineRef>
line = CTLineCreateWithAttributedString(checkmarkString);
3178 CTLineDraw((CTLineRef)
line, cg);
3181 CGContextRestoreGState(cg);
3190 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
w);
3192 auto *tb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3193 tb.enabled = isEnabled;
3196 [tb highlight:isPressed];
3197 const auto vOffset = [=] {
3205 CGContextTranslateCTM(
ctx, 0, vOffset);
3206 [tb.cell drawInteriorWithFrame:rect inView:tb];
3216 NSButtonCell *triangleCell =
static_cast<NSButtonCell *
>(
d->cocoaCell(
cw));
3217 [triangleCell setState:(opt->state & State_Open) ? NSControlStateValueOn : NSControlStateValueOff];
3219 [triangleCell setBackgroundStyle:((opt->state & State_Selected) && viewHasFocus) ? NSBackgroundStyleEmphasized : NSBackgroundStyleNormal];
3221 d->setupNSGraphicsContext(cg, NO);
3224 CGRect
rect = CGRectMake(qtRect.x() + 1, qtRect.y(), qtRect.width(), qtRect.height());
3225 CGContextTranslateCTM(cg,
rect.origin.x,
rect.origin.y +
rect.size.height);
3226 CGContextScaleCTM(cg, 1, -1);
3227 CGContextTranslateCTM(cg, -
rect.origin.x, -
rect.origin.y);
3229 [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]];
3231 d->restoreNSGraphicsContext(cg);
3235 QPen oldPen =
p->pen();
3251 auto *tf =
static_cast<NSTextField *
>(
d->cocoaControl(
cw));
3252 tf.enabled = isEnabled;
3253 tf.editable = !isReadOnly;
3255 static_cast<NSTextFieldCell *
>(tf.cell).bezelStyle = isRounded ? NSTextFieldRoundedBezel : NSTextFieldSquareBezel;
3256 tf.frame =
opt->
rect.toCGRect();
3258 if (!isDarkMode()) {
3263 CGContextRef cgContext = NSGraphicsContext.currentContext.CGContext;
3267 if (cgContext ? bool(CGBitmapContextGetColorSpace(cgContext)) : false) {
3268 tf.drawsBackground = YES;
3269 const QColor bgColor = frame->palette.brush(QPalette::Base).color();
3270 tf.backgroundColor = [NSColor colorWithSRGBRed:bgColor.redF()
3271 green:bgColor.greenF()
3272 blue:bgColor.blueF()
3273 alpha:bgColor.alphaF()];
3274 if (bgColor.alpha() != 255) {
3281 [tf.cell drawWithFrame:
rect inView:tf];
3308#if QT_CONFIG(lineedit)
3329#if QT_CONFIG(tabbar)
3332 QTabBar *tabBar = qobject_cast<QTabBar*>(
w->parentWidget());
3337 tabBar = qobject_cast<QTabBar *>(
const_cast<QWidget*
>(
w));
3338 closeBtn =
decltype(closeBtn)(
property(
"_q_styleSheetRealCloseButton").value<
void *>());
3344 if (!documentMode ||
3350 drawTabCloseButton(
p, hover, selected, pressed, documentMode);
3388 int imgw =
img.width();
3391 for (
int y = 0;
y < imgh; ++
y) {
3392 for (
int x = 0;
x < imgw; ++
x) {
3393 pixel =
img.pixel(
x,
y);
3396 hsvColor.getHsv(&
h, &
s, &
v);
3399 hsvColor.setHsv(
h,
s,
v);
3400 pixel = hsvColor.rgb();
3410 CGContextTranslateCTM(cg,
rect.size.height, 0);
3411 CGContextRotateCTM(cg,
M_PI_2);
3413 if (vertical != reverse) {
3414 CGContextTranslateCTM(cg,
rect.size.width, 0);
3415 CGContextScaleCTM(cg, -1, 1);
3426 QWindow *
window =
w &&
w->window() ?
w->window()->windowHandle() :
nullptr;
3427 d->resolveCurrentNSView(
window);
3436 bool noVerticalHeader =
true;
3437#if QT_CONFIG(tableview)
3439 if (
const QTableView *
table = qobject_cast<const QTableView *>(
w->parentWidget()))
3440 noVerticalHeader = !
table->verticalHeader()->isVisible();
3449 p->fillRect(ir, pressed ?
header->palette.dark() :
header->palette.button());
3463 myTb.
state &= ~State_AutoRaise;
3464#if QT_CONFIG(accessibility)
3465 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar)) {
3466 QRect cr = tb->rect;
3469 bool needText =
false;
3482 if (tb->icon.isNull() && !tb->text.isEmpty())
3498 QPixmap pixmap = tb->icon.pixmap(tb->rect.size().boundedTo(tb->iconSize),
p->device()->devicePixelRatio(),
3499 iconMode, iconState);
3507 cr.
adjust(0, pr.bottom(), 0, -3);
3510 pr.setWidth(
size.width() + 8);
3511 cr.
adjust(pr.right(), 0, 0, 0);
3516 pr.translate(shiftX, shiftY);
3535 QPen pen =
p->pen();
3582 d->autoDefaultButton =
nullptr;
3586 const bool isHighlighted =
isActive &&
3593 const auto cs =
d->effectiveAquaSizeConstrain(
btn,
w);
3595 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3600 pb.frame = frameRect.toCGRect();
3602 pb.enabled = isEnabled;
3607 [pb highlight:isPressed];
3611 pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff;
3615 pb.keyEquivalent = isHighlighted ?
@"\r" :
@"";
3618 d->drawNSViewInRect(pb, frameRect,
p, ^(
CGContextRef,
const CGRect &
r) {
3619 [pb.cell drawBezelWithFrame:r inView:pb.superview];
3627 const auto ir = frameRect.
toRect();
3628 int arrowYOffset = 0;
3633 arrowYOffset -= ir.top();
3683 if ((!hasIcon && !hasMenu) || (hasIcon && !hasText)) {
3711 int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2;
3712 int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmapSize.height()) / 2;
3713 QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmapSize.width(), pixmapSize.height());
3716 int newOffset = iconDestRect.x() + iconDestRect.width()
3729#if QT_CONFIG(combobox)
3731 if (
const auto *
cb = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
3732 auto comboCopy = *
cb;
3739#if QT_CONFIG(tabbar)
3741 if (
const auto *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
3742 if (tabOpt->documentMode) {
3744 bool isUnified =
false;
3746 QRect tabRect = tabOpt->rect;
3752 drawTabShape(
p, tabOpt, isUnified, tabOverlap);
3762 const auto tabDirection = QMacStylePrivate::tabDirection(tabOpt->shape);
3766 QStyleOptionTab::TabPosition tp = tabOpt->position;
3767 QStyleOptionTab::SelectedPosition
sp = tabOpt->selectedPosition;
3769 if (tp == QStyleOptionTab::Beginning)
3770 tp = QStyleOptionTab::End;
3771 else if (tp == QStyleOptionTab::End)
3772 tp = QStyleOptionTab::Beginning;
3774 if (
sp == QStyleOptionTab::NextIsSelected)
3775 sp = QStyleOptionTab::PreviousIsSelected;
3776 else if (
sp == QStyleOptionTab::PreviousIsSelected)
3777 sp = QStyleOptionTab::NextIsSelected;
3786 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
w);
3788 const bool needsInactiveHack = (!
isActive && isSelected);
3790 const auto ct = !needsInactiveHack && (isSelected || tp == QStyleOptionTab::OnlyOneTab) ?
3795 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3797 auto vOffset = isPopupButton ? 1 : 2;
3798 if (isBigSurOrAbove) {
3806 const auto outerAdjust = isPopupButton ? 1 : 4;
3807 const auto innerAdjust = isPopupButton ? 20 : 10;
3808 QRectF frameRect = tabOpt->rect;
3812 frameRect = frameRect.
translated(0, vOffset);
3814 case QStyleOptionTab::Beginning:
3817 frameRect = frameRect.
adjusted(-innerAdjust, 0, outerAdjust, 0);
3819 frameRect = frameRect.
adjusted(-outerAdjust, 0, innerAdjust, 0);
3821 if (isSelected && isBigSurOrAbove) {
3824 frameRect = frameRect.
adjusted(0, 0, 1, 0);
3828 case QStyleOptionTab::Middle:
3829 frameRect = frameRect.
adjusted(-innerAdjust, 0, innerAdjust, 0);
3831 if (isSelected && isBigSurOrAbove) {
3834 frameRect = frameRect.
adjusted(-1, 0, 1, 0);
3837 case QStyleOptionTab::Moving:
3838 case QStyleOptionTab::End:
3841 frameRect = frameRect.
adjusted(-innerAdjust, 0, outerAdjust, 0);
3843 frameRect = frameRect.
adjusted(-outerAdjust, 0, innerAdjust, 0);
3845 if (isSelected && isBigSurOrAbove) {
3847 frameRect = frameRect.
adjusted(-1, 0, 0, 0);
3850 case QStyleOptionTab::OnlyOneTab:
3851 frameRect = frameRect.
adjusted(-outerAdjust, 0, outerAdjust, 0);
3854 pb.frame = frameRect.toCGRect();
3856 if (!isPopupButton) {
3860 pb.buttonType = NSButtonTypePushOnPushOff;
3863 pb.enabled = isEnabled;
3864 [pb highlight:isPressed];
3869 pb.state = (
isActive && isSelected) ? NSControlStateValueOn : NSControlStateValueOff;
3871 pb.state = (
isActive && isSelected && !isPressed) ? NSControlStateValueOn : NSControlStateValueOff;
3874 CGContextClipToRect(
ctx,
opt->
rect.toCGRect());
3875 if (!isSelected || needsInactiveHack) {
3879 CGContextScaleCTM(
ctx, -1, 1);
3880 CGContextTranslateCTM(
ctx, -frameRect.
left(), 0);
3883 CGContextScaleCTM(
ctx, 1, -1);
3884 CGContextTranslateCTM(
ctx, 0, -frameRect.
right());
3887 CGContextScaleCTM(
ctx, 1, -1);
3888 CGContextTranslateCTM(
ctx, 0, -frameRect.
left());
3895 CGContextTranslateCTM(
ctx, 0, frameRect.
right());
3897 CGContextTranslateCTM(
ctx, -frameRect.
left(), 0);
3905 NSPopUpArrowPosition
oldPosition = NSPopUpArrowAtCenter;
3906 NSPopUpButtonCell *pbCell = nil;
3908 if (isPopupButton && (tp == QStyleOptionTab::OnlyOneTab || isBigSurOrAbove)) {
3912 pbCell =
static_cast<NSPopUpButtonCell *
>(pb.cell);
3914 pbCell.arrowPosition = NSPopUpNoArrow;
3915 if (pb.state == NSControlStateValueOff) {
3917 rAdjusted.origin.
x -= 3;
3918 rAdjusted.size.width += 6;
3919 if (isBigSurOrAbove) {
3920 if (tp == QStyleOptionTab::End)
3921 rAdjusted.origin.x -= 2;
3926 [pb.cell drawBezelWithFrame:rAdjusted inView:pb.superview];
3932 if (needsInactiveHack) {
3934 const qreal pixelRatio =
p->device()->devicePixelRatio();
3936 tabPixmap.setDevicePixelRatio(pixelRatio);
3939 d->drawNSViewInRect(pb, frameRect, &tabPainter, ^(
CGContextRef ctx,
const CGRect &
r) {
3941 drawBezelBlock(
ctx,
r);
3946 const qreal inactiveGray = 0.898;
3947 const int inactiveGray8 =
qRound(inactiveGray * 255.0);
3948 const QRgb inactiveGrayRGB =
qRgb(inactiveGray8, inactiveGray8, inactiveGray8);
3949 for (
int l = 0; l < tabPixmap.height(); ++l) {
3950 auto *
line =
reinterpret_cast<QRgb*
>(tabPixmap.scanLine(l));
3951 for (
int i = 0;
i < tabPixmap.width(); ++
i) {
3953 line[i] = inactiveGrayRGB;
3962 p->drawImage(
opt->
rect, tabPixmap);
3964 d->drawNSViewInRect(pb, frameRect,
p, drawBezelBlock);
3967 if (!isSelected &&
sp != QStyleOptionTab::NextIsSelected
3968 && tp != QStyleOptionTab::End
3969 && tp != QStyleOptionTab::OnlyOneTab) {
3972 p->setOpacity(isEnabled ? 0.105 : 0.06);
3973 p->setPen(separatorPen);
3989 if (
const auto *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
3990 QStyleOptionTab myTab = *tab;
3992 const auto tabDirection = QMacStylePrivate::tabDirection(tab->shape);
4003 if (
const auto *tabBar = qobject_cast<const QTabBar *>(
w))
4004 if (!tabBar->tabTextColor(tabBar->currentIndex()).isValid())
4005 myTab.palette.setColor(foregroundRole,
Qt::white);
4012 int heightOffset = 0;
4015 }
else if (nonDefaultFont) {
4016 if (
p->fontMetrics().height() == myTab.rect.height())
4019 myTab.rect.setHeight(myTab.rect.height() + heightOffset);
4025#if QT_CONFIG(dockwidget)
4027 if (
const auto *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(
opt)) {
4028 const bool isVertical = dwOpt->verticalTitleBar;
4032 p->
translate(effectiveRect.left(), effectiveRect.top() + effectiveRect.width());
4034 p->translate(-effectiveRect.left(), -effectiveRect.top());
4042 p->drawLine(effectiveRect.bottomLeft(), effectiveRect.bottomRight());
4044 if (!dwOpt->title.isEmpty()) {
4048 effectiveRect.top() + titleRect.left() -
opt->
rect.
left(),
4052 const auto text =
p->fontMetrics().elidedText(dwOpt->title,
Qt::ElideRight, titleRect.width());
4061 const auto *ff = qobject_cast<const QFocusFrame *>(
w);
4062 const auto *ffw = ff ? ff->widget() :
nullptr;
4063 const auto ct = [=] {
4065 if (qobject_cast<const QCheckBox*>(ffw))
4067 if (qobject_cast<const QRadioButton*>(ffw))
4069 if (qobject_cast<const QLineEdit*>(ffw) || qobject_cast<const QTextEdit*>(ffw))
4071 if (
const auto *pb = qobject_cast<const QPushButton *>(ffw)) {
4080 if (pb->menu() !=
nullptr)
4106 p->fillRect(mi->rect, mi->palette.highlight());
4112 p->drawLine(mi->rect.x() + 2, mi->rect.y() + mi->rect.height() / 2 - 1,
4113 mi->rect.x() + mi->rect.width() - 4,
4114 mi->rect.y() + mi->rect.height() / 2 - 1);
4116 p->drawLine(mi->rect.x() + 2, mi->rect.y() + mi->rect.height() / 2,
4117 mi->rect.x() + mi->rect.width() - 4,
4118 mi->rect.y() + mi->rect.height() / 2);
4121 const int scrollerVOffset = 5;
4122 const int left = mi->rect.x() + (mi->rect.width() - scrollerSize.width()) / 2;
4123 const int right =
left + scrollerSize.width();
4127 bottom = mi->rect.y() + scrollerVOffset;
4130 bottom = mi->rect.bottom() - scrollerVOffset;
4146 CGColorRef separatorColor = [NSColor quaternaryLabelColor].CGColor;
4147 const QRect separatorRect =
QRect(mi->rect.left(), mi->rect.center().y(), mi->rect.width(), 2);
4152 const int maxpmw = mi->maxIconWidth;
4155 int xpos = mi->rect.x() + 18;
4156 int checkcol = maxpmw;
4158 p->setPen(mi->palette.text().color());
4160 p->setPen(mi->palette.highlightedText().color());
4162 p->setPen(mi->palette.buttonText().color());
4171 checkmarkOpt.rect =
QRect(xp, mi->rect.y() - checkmarkOpt.fontMetrics.descent(), mw, mh);
4173 checkmarkOpt.state.setFlag(
State_On, active);
4186 if (!mi->icon.isNull()) {
4192#if QT_CONFIG(combobox)
4193 if (
const QComboBox *comboBox = qobject_cast<const QComboBox *>(
w)) {
4198 QRect cr(xpos, mi->rect.y(), checkcol, mi->rect.height());
4201 pmr.moveCenter(cr.
center());
4202 p->drawPixmap(pmr.topLeft(),
pixmap);
4203 xpos +=
size.width() + 6;
4209 int yPos = mi->rect.y();
4214 const int tabwidth = isSubMenu ? 9 : mi->reservedShortcutWidth;
4222 if (tabIndex >= 0) {
4224 rightMarginText =
s.mid(tabIndex + 1);
4225 s =
s.left(tabIndex);
4229 if (!rightMarginText.isEmpty()) {
4233 p->drawText(xp, yPos, tabwidth, mi->rect.height(), text_flags |
Qt::AlignRight, rightMarginText);
4238 if (seq.
count() == 1) {
4240 const int maxKeyWidth =
p->fontMetrics().maxWidth();
4241 const QChar key = rightMarginText.at(rightMarginText.length() - 1);
4243 p->drawText(xp + tabwidth - maxKeyWidth, yPos, maxKeyWidth, mi->rect.height(), text_flags,
key);
4245 p->drawText(xp, yPos, tabwidth - maxKeyWidth, mi->rect.height(),
4248 p->drawText(xp, yPos, tabwidth, mi->rect.height(), text_flags, rightMarginText);
4255 QFont myFont = mi->font;
4266 const auto *fontEngine =
QFontPrivate::get(myFont)->engineForScript(QChar::Script_Common);
4273 NSFont *
f = (NSFont *)(CTFontRef)fontEngine->handle();
4276 const auto pc =
p->pen().color();
4277 NSColor *
c = [NSColor colorWithSRGBRed:pc.redF()
4285 d->setupNSGraphicsContext(cgCtx, YES);
4291 [s.toNSString() drawAtPoint:CGPointMake(xpos, yPos)
4292 withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c,
4293 NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0],
4294 NSUnderlineStyleAttributeName: [NSNumber numberWithInt: myFont.underline() ? NSUnderlineStyleSingle
4295 : NSUnderlineStyleNone]}];
4297 d->restoreNSGraphicsContext(cgCtx);
4300 p->drawText(xpos, yPos, mi->rect.width() - xm - tabwidth + 1,
4301 mi->rect.height(), text_flags,
s);
4311 const QBrush bg = selected ? mi->palette.highlight() : mi->palette.window();
4312 p->fillRect(mi->rect, bg);
4317 if (!mi->icon.isNull()) {
4322 mi->icon.pixmap(
QSize(iconExtent, iconExtent),
p->device()->devicePixelRatio(),
4339 const bool isIndeterminate = (pb->minimum == 0 && pb->maximum == 0);
4341 const bool inverted = pb->invertedAppearance;
4349 const CGRect cgRect =
rect.toCGRect();
4351 const auto aquaSize =
d->effectiveAquaSizeConstrain(
opt,
w);
4356 if (isIndeterminate) {
4369 [ipi startAnimation];
4372 d->setupNSGraphicsContext(cg, NO);
4373 d->setupVerticalInvertedXform(cg, reverse, vertical, cgRect);
4374 [ipi drawWithFrame:cgRect inView:d->backingStoreNSView];
4375 d->restoreNSGraphicsContext(cg);
4379 [ipi stopAnimation];
4383 auto *pi =
static_cast<NSProgressIndicator *
>(
d->cocoaControl(
cw));
4385 d->setupVerticalInvertedXform(
ctx, reverse, vertical,
rect);
4386 pi.minValue = pb->minimum;
4387 pi.maxValue = pb->maximum;
4388 pi.doubleValue = pb->progress;
4396#ifndef QT_NO_MDIAREA
4397 if (!
w || !qobject_cast<QMdiSubWindow *>(
w->parentWidget()))
4405 lineColor.setWidth(1);
4408 p->setPen(lineColor);
4410 const int NumLines = 3;
4411 for (
int l = 0; l < NumLines; ++l) {
4412 const int offset = (l * 4 + 3);
4432 auto *sv =
static_cast<NSSplitView *
>(
d->cocoaControl(
cw));
4433 sv.frame =
opt->
rect.toCGRect();
4435 [sv drawDividerInRect:rect];
4438 QPen oldPen =
p->pen();
4448 if (
const QStyleOptionRubberBand *rubber = qstyleoption_cast<const QStyleOptionRubberBand *>(
opt)) {
4450 if (!rubber->opaque) {
4453 strokeColor.
setHsvF(0, 0, 0.86, 1.0);
4454 fillColor.
setHsvF(0, 0, 0.53, 0.25);
4456 p->fillRect(
opt->
rect, strokeColor);
4458 QPen oldPen =
p->pen();
4460 QPen pen(strokeColor);
4462 p->setBrush(fillColor);
4465 p->drawRect(adjusted);
4467 p->setBrush(oldBrush);
4474#ifndef QT_NO_TOOLBAR
4476 const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(
opt);
4484#if QT_CONFIG(mainwindow)
4485 if (
QMainWindow * mainWindow = qobject_cast<QMainWindow *>(
w->window())) {
4486 if (toolBar && toolBar->toolBarArea ==
Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) {
4499 if (isEndOfUnifiedArea) {
4520 linearGrad.setColorAt(0, mainWindowGradientBegin);
4521 linearGrad.setColorAt(1, mainWindowGradientEnd);
4522 p->fillRect(
opt->
rect, linearGrad);
4528 p->drawLine(toolbarRect.topLeft(), toolbarRect.topRight());
4530 p->drawLine(toolbarRect.bottomLeft(), toolbarRect.bottomRight());
4533 p->drawLine(toolbarRect.topLeft(), toolbarRect.bottomLeft());
4535 p->drawLine(toolbarRect.topRight(), toolbarRect.bottomRight());
4565#if QT_CONFIG(itemviews)
4567 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
4571 if (vopt->features & QStyleOptionViewItem::HasDecoration)
4572 rect.adjust(-fw, 0, 0, 0);
4591 const auto cs =
d->effectiveAquaSizeConstrain(
btn,
widget);
4593 auto frameRect =
cw.adjustedControlFrame(
btn->
rect);
4595 frameRect -=
cw.titleMargins();
4597 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
4598 frameRect = QRectF::fromCGRect([pb alignmentRectForFrame:frameRect.toCGRect()]);
4604 rect = frameRect.toRect();
4655#if QT_CONFIG(tabwidget)
4657 if (
const QStyleOptionTabWidgetFrame *twf
4658 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4659 switch (twf->shape) {
4666 rect =
QRect(
QPoint(0, twf->rect.height() - twf->leftCornerWidgetSize.height()),
4667 twf->leftCornerWidgetSize);
4676 if (
const QStyleOptionTabWidgetFrame *twf
4677 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4678 switch (twf->shape) {
4681 rect =
QRect(
QPoint(twf->rect.width() - twf->rightCornerWidgetSize.width(), 0),
4682 twf->rightCornerWidgetSize);
4686 rect =
QRect(
QPoint(twf->rect.width() - twf->rightCornerWidgetSize.width(),
4687 twf->rect.height() - twf->rightCornerWidgetSize.height()),
4688 twf->rightCornerWidgetSize);
4698 if (
const auto *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4699 if (twf->lineWidth != 0) {
4700 switch (QMacStylePrivate::tabDirection(twf->shape)) {
4702 rect.adjust(+1, +14, -1, -1);
4705 rect.adjust(+1, +1, -1, -14);
4708 rect.adjust(+14, +1, -1, -1);
4711 rect.adjust(+1, +1, -14, -1);
4717 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4718 QRect dummyIconRect;
4724 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4737 verticalShift = -verticalShift;
4739 qSwap(horizontalShift, verticalShift);
4740 horizontalShift *= -1;
4741 verticalShift *= -1;
4744 horizontalShift = -horizontalShift;
4746 tr.adjust(0, 0, horizontalShift, verticalShift);
4749 tr.setBottom(
tr.bottom() - verticalShift);
4750 tr.setRight(
tr.right() - horizontalShift);
4754 int w =
size.width();
4755 int h =
size.height();
4756 int midHeight =
static_cast<int>(
qCeil(
float(
tr.height() -
h) / 2));
4757 int midWidth = ((
tr.width() -
w) / 2);
4759 bool atTheTop =
true;
4760 switch (tab->shape) {
4771 rect =
QRect(tab->rect.x() + hpadding, midHeight,
w,
h);
4773 rect =
QRect(tab->rect.right() -
w - hpadding, midHeight,
w,
h);
4778 rect =
QRect(midWidth,
tr.y() + tab->rect.height() - hpadding -
h,
w,
h);
4787#if QT_CONFIG(combobox)
4789 rect.adjust(-1, -2, 0, 0);
4792 rect.adjust(-1, -1, 0, +1);
4805#ifndef QT_NO_TOOLBAR
4840 = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
4848 rect.adjust(+5, +4, -5, -6);
4850 rect.adjust(+1, 0, -1, -2);
4858 rect.adjust(0, +4, 0, -6);
4860 rect.adjust(0, 0, 0, -2);
4869 rect.adjust(0, +6, 0 , -5);
4871 rect.adjust(0, +6, 0 , -7);
4875 if (
const QStyleOptionSlider *sliderOpt
4876 = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4879 int above =
SIZE(3, 0, 2);
4880 int below =
SIZE(4, 3, 0);
4882 rect.adjust(0, +above, 0, -below);
4884 rect.adjust(+above, 0, -below, 0);
4887 int below =
SIZE(3, 2, 0);
4889 rect.setHeight(
rect.height() - below);
4891 rect.setWidth(
rect.width() - below);
4894 int above =
SIZE(3, 2, 0);
4912 rect.adjust(+1, 0, -1, 0);
4922 qstyleoption_cast<const QStyleOptionGroupBox *>(
opt)) {
4932 delta =
SIZE(8, 4, 4);
4934 delta =
SIZE(15, 12, 12);
4941#if QT_CONFIG(tabwidget)
4943 if (
const QStyleOptionTabWidgetFrame *tabWidgetOpt =
4944 qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4950 rect = tabWidgetOpt->rect;
4956#if QT_CONFIG(dockwidget)
4966 = qstyleoption_cast<const QStyleOptionDockWidget*>(
opt);
4967 bool canClose = dwOpt == 0 ? true : dwOpt->closable;
4968 bool canFloat = dwOpt == 0 ?
false : dwOpt->floatable;
4970 const bool verticalTitleBar = dwOpt->verticalTitleBar;
4974 if (verticalTitleBar)
4975 srect = srect.transposed();
4978 int right = srect.right();
4979 int left = srect.left();
4985 sz +=
QSize(buttonMargin, buttonMargin);
4986 if (verticalTitleBar)
4989 srect.center().y() - sz.
height()/2,
4991 left = closeRect.right() + 1;
5002 sz +=
QSize(buttonMargin, buttonMargin);
5003 if (verticalTitleBar)
5006 srect.center().y() - sz.
height()/2,
5008 left = floatRect.right() + 1;
5018 if (dw->isFloating())
5019 icon = dw->windowIcon();
5023 if (verticalTitleBar)
5027 right = iconRect.left() - 1;
5043 if (verticalTitleBar) {
5045 srect.top() + srect.right() -
rect.right(),
5073 CGContextSaveGState(cg);
5074 [NSGraphicsContext saveGraphicsState];
5076 [NSGraphicsContext setCurrentContext:
5077 [NSGraphicsContext graphicsContextWithCGContext:cg flipped:flipped]];
5082 [NSGraphicsContext restoreGraphicsState];
5083 CGContextRestoreGState(cg);
5093 d->resolveCurrentNSView(
window);
5096 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5099 const bool drawKnob = sb->subControls &
SC_ScrollBarSlider && sb->minimum != sb->maximum;
5100 if (!drawTrack && !drawKnob)
5108 static const CGFloat knobWidths[] = { 7.0, 5.0, 5.0 };
5109 static const CGFloat expandedKnobWidths[] = { 11.0, 9.0, 9.0 };
5110 const auto cocoaSize =
d->effectiveAquaSizeConstrain(
opt,
widget);
5111 const CGFloat maxExpandScale = expandedKnobWidths[cocoaSize] / knobWidths[cocoaSize];
5117 bool wasActive =
false;
5121 bool shouldExpand =
false;
5128 const QStyle::State oldState =
static_cast<QStyle::State
>(
styleObject->
property(
"_q_stylestate").
value<QStyle::State::Int>());
5136 oldPos != sb->sliderPosition ||
5137 oldMin != sb->minimum ||
5138 oldMax != sb->maximum ||
5139 oldRect != sb->rect ||
5140 oldState != sb->state ||
5141 oldActiveControls != sb->activeSubControls) {
5158 d->startAnimation(anim);
5173 if (oldActiveControls)
5180 shouldExpand =
isTransient && (
opt->activeSubControls || wasActive);
5182 if (!anim && !oldActiveControls) {
5185 d->startAnimation(anim);
5188 expandScale = 1.0 + (maxExpandScale - 1.0) * anim->
currentValue();
5192 expandScale = maxExpandScale;
5198 d->setupNSGraphicsContext(cg, NO );
5202 NSScroller *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5205 const bool hasDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
5209 scroller.knobStyle = hasDarkBg? NSScrollerKnobStyleLight : NSScrollerKnobStyleDark;
5211 scroller.knobStyle = NSScrollerKnobStyleDefault;
5220 CGContextBeginTransparencyLayerWithRect(cg,
scroller.frame,
nullptr);
5221 CGContextSetAlpha(cg, opacity);
5227 CGRect trackRect =
scroller.bounds;
5229 trackRect.origin.y += expandOffset;
5231 trackRect.origin.x += expandOffset;
5232 [scroller drawKnobSlotInRect:trackRect highlight:NO];
5242 const CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:scroller.controlSize scrollerStyle:scroller.scrollerStyle];
5243 const CGFloat knobWidth = knobWidths[cocoaSize] * expandScale;
5245 const CGRect scrollerKnobRect = CGRectInset([
scroller rectForPart:NSScrollerKnob], 1, 1);
5246 const CGFloat knobLength = isHorizontal ? scrollerKnobRect.size.width : scrollerKnobRect.size.height;
5247 const CGFloat knobPos = isHorizontal ? scrollerKnobRect.origin.x : scrollerKnobRect.origin.y;
5248 const CGFloat knobOffset =
qRound((scrollerWidth + expandOffset - knobWidth) / 2.0);
5249 const CGFloat knobRadius = knobWidth / 2.0;
5252 knobRect = CGRectMake(knobPos, knobOffset, knobLength, knobWidth);
5254 knobRect = CGRectMake(knobOffset, knobPos, knobWidth, knobLength);
5255 QCFType<CGPathRef> knobPath = CGPathCreateWithRoundedRect(knobRect, knobRadius, knobRadius,
nullptr);
5256 CGContextAddPath(cg, knobPath);
5257 CGContextSetAlpha(cg, 0.5);
5258 CGColorRef knobColor = hasDarkBg ? NSColor.whiteColor.CGColor : NSColor.blackColor.CGColor;
5259 CGContextSetFillColorWithColor(cg, knobColor);
5260 CGContextFillPath(cg);
5262 [scroller drawKnob];
5269 CGContextSetBlendMode(cg, kCGBlendModePlusDarker);
5270 [scroller drawKnob];
5276 CGContextEndTransparencyLayer(cg);
5278 d->restoreNSGraphicsContext(cg);
5282 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5285 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5287 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5300 const CGRect knobRect = [slider.cell knobRectFlipped:slider.isFlipped];
5301 pressPoint.x = CGRectGetMidX(knobRect);
5302 pressPoint.y = CGRectGetMidY(knobRect);
5311 [slider.cell startTrackingAt:pressPoint inView:slider];
5312 [slider.cell startTrackingAt:pressPoint inView:slider];
5318 const bool verticalFlip = !isHorizontal && !sl->upsideDown;
5321 if (sl->upsideDown) {
5322 CGContextTranslateCTM(ctx, rect.size.width, rect.origin.y);
5323 CGContextScaleCTM(ctx, -1, 1);
5325 CGContextTranslateCTM(ctx, 0, rect.origin.y);
5327 }
else if (verticalFlip) {
5328 CGContextTranslateCTM(
ctx,
rect.origin.x,
rect.size.height);
5329 CGContextScaleCTM(
ctx, 1, -1);
5332 if (hasDoubleTicks) {
5335 CGContextTranslateCTM(
ctx, 0, 4);
5337 CGContextTranslateCTM(
ctx, 1, 0);
5344 const bool drawAllParts = drawKnob && drawBar && (!hasTicks || drawTicks);
5345 if (drawAllParts && !hasDoubleTicks && (!verticalFlip || drawTicks)) {
5349 if (verticalFlip && drawTicks) {
5352 slider.intValue = slider.maxValue - slider.intValue + slider.minValue;
5354 [slider drawRect:CGRectZero];
5358 NSSliderCell *cell = slider.cell;
5360 const int numberOfTickMarks = slider.numberOfTickMarks;
5363 slider.numberOfTickMarks = 0;
5365 const CGRect barRect = [cell barRectFlipped:slider.isFlipped];
5367 if (!isHorizontal && !sl->upsideDown && (hasDoubleTicks || !hasTicks)) {
5375 [cell drawBarInside:barRect flipped:true];
5377 [cell drawBarInside:barRect flipped:!verticalFlip];
5381 slider.numberOfTickMarks = numberOfTickMarks;
5384 if (hasTicks && drawTicks) {
5385 if (!drawBar && hasDoubleTicks)
5386 slider.numberOfTickMarks = numberOfTickMarks;
5388 [cell drawTickMarks];
5390 if (hasDoubleTicks) {
5392 CGAffineTransform tickMarksFlip;
5393 const CGRect tickMarkRect = [cell rectOfTickMarkAtIndex:0];
5395 tickMarksFlip = CGAffineTransformMakeTranslation(0,
rect.size.height - tickMarkRect.size.height - 3);
5396 tickMarksFlip = CGAffineTransformScale(tickMarksFlip, 1, -1);
5398 tickMarksFlip = CGAffineTransformMakeTranslation(
rect.size.width - tickMarkRect.size.width / 2, 0);
5399 tickMarksFlip = CGAffineTransformScale(tickMarksFlip, -1, 1);
5401 CGContextConcatCTM(
ctx, tickMarksFlip);
5402 [cell drawTickMarks];
5403 CGContextConcatCTM(
ctx, CGAffineTransformInvert(tickMarksFlip));
5410 slider.numberOfTickMarks = 0;
5419 [slider.cell stopTracking:pressPoint at:pressPoint inView:slider mouseIsUp:NO];
5420 [slider.cell stopTracking:pressPoint at:pressPoint inView:slider mouseIsUp:NO];
5424#if QT_CONFIG(spinbox)
5426 if (
const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
5443 d->setupNSGraphicsContext(cg, NO);
5445 const auto aquaSize =
d->effectiveAquaSizeConstrain(
opt,
widget);
5447 NSStepperCell *cell =
static_cast<NSStepperCell *
>(
d->cocoaCell(
cw));
5450 const CGRect newRect = [cell drawingRectForBounds:updown.toCGRect()];
5454 const CGFloat x = CGRectGetMidX(newRect);
5455 const CGFloat y = upPressed ? -3 : 3;
5456 const CGPoint pressPoint = CGPointMake(
x,
y);
5459 if (upPressed || downPressed)
5460 [cell startTrackingAt:pressPoint inView:d->backingStoreNSView];
5462 [cell drawWithFrame:newRect inView:d->backingStoreNSView];
5464 if (upPressed || downPressed)
5465 [cell stopTracking:pressPoint at:pressPoint inView:d->backingStoreNSView mouseIsUp:NO];
5467 d->restoreNSGraphicsContext(cg);
5472#if QT_CONFIG(combobox)
5474 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
5479 const auto cs =
d->effectiveAquaSizeConstrain(combo,
widget);
5481 auto *cc =
static_cast<NSControl *
>(
d->cocoaControl(
cw));
5482 cc.enabled = isEnabled;
5483 QRectF frameRect =
cw.adjustedControlFrame(combo->rect);
5486 auto *pb =
static_cast<NSPopUpButton *
>(cc);
5494 pb.frame = frameRect.toCGRect();
5495 [pb highlight:isPressed];
5496 d->drawNSViewInRect(pb, frameRect,
p, ^(
CGContextRef,
const CGRect &
r) {
5497 [pb.cell drawBezelWithFrame:r inView:pb.superview];
5501 auto *
cb =
static_cast<NSComboBox *
>(cc);
5502 const auto frameRect =
cw.adjustedControlFrame(combo->rect);
5503 cb.frame = frameRect.toCGRect();
5506 if (NSButtonCell *cell =
static_cast<NSButtonCell *
>([cc.cell qt_valueForPrivateKey:
@"_buttonCell"])) {
5507 cell.highlighted = isPressed;
5514 [cb.cell drawWithFrame:r inView:cb];
5524 focusRect = QRectF::fromCGRect([cc alignmentRectForFrame:cc.frame]);
5527 focusRect = focusRect.translated(0, 1);
5529 focusRect = focusRect.translated(2, -1);
5539 if (
const auto *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(
opt)) {
5550 QPainterPath outerFramePath =
d->windowPanelPath(outerFrameRect);
5553 const auto frameAdjust = 1.0 /
p->device()->devicePixelRatio();
5554 const auto innerFrameRect = outerFrameRect.adjusted(frameAdjust, frameAdjust, -frameAdjust, 0);
5555 QPainterPath innerFramePath =
d->windowPanelPath(innerFrameRect);
5566 for (
const auto sc : buttons) {
5567 const auto ct =
d->windowButtonCocoaControl(sc);
5569 auto *wb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
5570 wb.enabled = (sc & titlebar->subControls) &&
isActive;
5571 [wb highlight:(titlebar->state & State_Sunken) && (sc & titlebar->activeSubControls)];
5576 auto *wbCell =
static_cast<NSButtonCell *
>(wb.cell);
5577 [wbCell drawWithFrame:rect inView:wb];
5584 if (!titlebar->icon.isNull()) {
5593 if (!titlebar->text.isEmpty())
5600 = qstyleoption_cast<const QStyleOptionGroupBox *>(
opt)) {
5611 if (didModifySubControls)
5614 if (didModifySubControls) {
5618 const QFont savedFont =
p->font();
5619 if (!flat &&
d->smallSystemFont)
5620 p->setFont(*
d->smallSystemFont);
5623 p->setFont(savedFont);
5629 = qstyleoption_cast<const QStyleOptionToolButton *>(
opt)) {
5630#if QT_CONFIG(accessibility)
5631 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar)) {
5635 arrowOpt.rect.setY(arrowOpt.rect.y() + arrowOpt.rect.height() / 2);
5636 arrowOpt.rect.setHeight(arrowOpt.rect.height() / 2);
5640 d->drawToolbarButtonArrow(tb,
p);
5646 isKey = [view.window isKeyWindow];
5650 path.addRoundedRect(
QRectF(tb->rect.x(), tb->rect.y(), tb->rect.width(), tb->rect.height() + 4), 4, 4);
5658 auto bflags = tb->state;
5661 auto mflags = tb->state;
5671 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5673 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
5674 pb.bezelStyle = NSBezelStyleShadowlessSquare;
5675 pb.frame =
opt->
rect.toCGRect();
5676 pb.buttonType = NSButtonTypePushOnPushOff;
5677 pb.enabled = isEnabled;
5678 [pb highlight:isPressed];
5679 pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff;
5682 [pb.cell drawBezelWithFrame:rect inView:pb];
5696 d->drawToolbarButtonArrow(tb,
p);
5708 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(
opt))
5709 QStyleHelper::drawDial(dial,
p);
5733 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5734 if (!sl->rect.contains(pt))
5740 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5742 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5746 NSSliderCell *cell = slider.cell;
5747 const auto barRect = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]);
5748 const auto knobRect = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]);
5749 if (knobRect.contains(pt)) {
5751 }
else if (barRect.contains(pt)) {
5753 }
else if (hasTicks) {
5759 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5760 if (!sb->rect.contains(pt)) {
5767 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5769 auto *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5778 const auto knobRect = QRectF::fromCGRect([
scroller rectForPart:NSScrollerKnob]);
5781 if (pt.
x() < knobRect.left())
5783 else if (pt.
x() > knobRect.right())
5788 if (pt.
y() < knobRect.top())
5790 else if (pt.
y() > knobRect.bottom())
5811 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5813 const bool isReverseHorizontal = isHorizontal && (sb->direction ==
Qt::RightToLeft);
5815 NSScrollerPart part = NSScrollerNoPart;
5817 part = NSScrollerKnob;
5819 part = NSScrollerKnobSlot;
5823 part = NSScrollerDecrementPage;
5825 part = NSScrollerIncrementPage;
5829 if (part != NSScrollerNoPart) {
5831 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5833 auto *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5835 ret = QRectF::fromCGRect([
scroller rectForPart:part]).toRect();
5840 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5844 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5846 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5850 NSSliderCell *cell = slider.cell;
5852 ret = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]).toRect();
5854 ret.setTop(sl->rect.top());
5855 ret.setBottom(sl->rect.bottom());
5857 ret.setLeft(sl->rect.left());
5858 ret.setRight(sl->rect.right());
5861 ret = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]).toRect();
5863 const auto tickMarkRect = QRectF::fromCGRect([cell rectOfTickMarkAtIndex:0]);
5865 ret =
QRect(sl->rect.left(), tickMarkRect.top(), sl->rect.width(), tickMarkRect.height());
5867 ret =
QRect(tickMarkRect.left(), sl->rect.top(), tickMarkRect.width(), sl->rect.height());
5872 if (sl->upsideDown) {
5873 ret =
QRect(sl->rect.right() -
ret.right(), sl->rect.top(),
ret.width(), sl->rect.height());
5875 ret.setTop(sl->rect.top());
5876 ret.setBottom(sl->rect.bottom());
5879 if (!sl->upsideDown) {
5880 ret =
QRect(sl->rect.left(), sl->rect.bottom() -
ret.bottom(), sl->rect.width(),
ret.height());
5882 ret.setLeft(sl->rect.left());
5883 ret.setRight(sl->rect.right());
5889 if (
const auto *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(
opt)) {
5896 qreal labelWidth = titlebar->fontMetrics.horizontalAdvance(titlebar->text) + 1;
5897 qreal labelHeight = titlebar->fontMetrics.height();
5901 if (!titlebar->icon.isNull()) {
5910 labelWidth, labelHeight);
5912 const auto currentButton =
d->windowButtonCocoaControl(sc);
5921 auto *wb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
5922 if (ct == currentButton)
5923 buttonSize = QSizeF::fromCGSize(wb.frame.size);
5928 const auto vOffset = (
opt->
rect.
height() - buttonSize.height()) / 2.0;
5936 const auto cs =
d->effectiveAquaSizeConstrain(combo,
widget);
5942 ret = editRect.toAlignedRect();
5945 ret = editRect.toAlignedRect();
5947 ret.setWidth(combo->rect.right() -
ret.right());
5950 if (combo->editable) {
5952 const int comboTop = combo->rect.top();
5955 qRound(inner.origin.x - combo->rect.left() + inner.size.width),
5956 editRect.bottom() - comboTop + 2);
5958 ret =
QRect(combo->rect.x() + 4 - 11,
5959 combo->rect.y() + 1,
5960 editRect.width() + 10 + 11,
5973 bool hasNoText = !checkable &&
groupBox->text.isEmpty();
5981 const int margin = flat || hasNoText ? 0 : 9;
5984 const QFontMetricsF fm = flat || fontIsSet || !
d->smallSystemFont
5988 const int tw =
qCeil(
s.width());
5989 const int h =
qCeil(fm.height());
5994 if (flat && checkable)
5995 labelRect.moveLeft(labelRect.left() + 4);
6000 int newSum = indicatorWidth + 1;
6001 int newLeft = labelRect.left() + (rtl ? -newSum : newSum);
6002 labelRect.moveLeft(newLeft);
6004 labelRect.moveTop(labelRect.top() + 3);
6006 labelRect.moveTop(labelRect.top() + 4);
6008 int newLeft = labelRect.left() - (rtl ? 3 : -3);
6009 labelRect.moveLeft(newLeft);
6010 labelRect.moveTop(labelRect.top() + 3);
6012 int newLeft = labelRect.left() - (rtl ? 3 : 2);
6013 labelRect.moveLeft(newLeft);
6014 labelRect.moveTop(labelRect.top() + 4);
6020 int left = rtl ? labelRect.right() - indicatorWidth : labelRect.left() - 1;
6021 int top = flat ?
ret.top() + 1 :
ret.top() + 5;
6043 ret.adjust(3, -5, -3, -4);
6045 ret.adjust(3, 3, -3, -4);
6055#if QT_CONFIG(spinbox)
6057 if (
const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
6086 const int x = spin->rect.width() - spinner_w;
6087 ret.setRect(
x + spin->rect.x(),
y + spin->rect.y(), spinner_w, spin->rect.height() -
y * 2);
6094 hackTranslateX = -2;
6097 hackTranslateX = -1;
6104 NSStepperCell *cell =
static_cast<NSStepperCell *
>(
d->cocoaCell(
cw));
6105 const CGRect outRect = [cell drawingRectForBounds:ret.toCGRect()];
6106 ret = QRectF::fromCGRect(outRect).toRect();
6110 ret.setHeight(
ret.height() / 2);
6119 ret.translate(hackTranslateX, 0);
6124 ret = spin->rect.adjusted(fw, fw, -fw, -fw);
6126 ret.setWidth(spin->rect.width() - spinBoxSep - spinner_w);
6140#if QT_CONFIG(accessibility)
6141 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar))
6144 ret.adjust(-1, 0, 0, 0);
6159 bool useAquaGuideline =
true;
6162#if QT_CONFIG(spinbox)
6164 if (
const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
6167 sz +=
QSize(buttonWidth, 0);
6206#if QT_CONFIG(tabwidget)
6207 if (
const QStyleOptionTabWidgetFrame *twf
6208 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
6211 const int gapBetweenTabbarAndStackWidget = 2 + 14 - overlap;
6213 const auto tabDirection = QMacStylePrivate::tabDirection(twf->shape);
6216 extra =
QSize(2, gapBetweenTabbarAndStackWidget + 1);
6218 extra =
QSize(gapBetweenTabbarAndStackWidget + 1, 2);
6224#if QT_CONFIG(tabbar)
6226 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
6229 const auto tabDirection = QMacStylePrivate::tabDirection(tab->shape);
6235 int defaultTabHeight;
6236 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
6239 if (tab->documentMode)
6240 defaultTabHeight = 24;
6242 defaultTabHeight = 21;
6245 defaultTabHeight = 18;
6248 defaultTabHeight = 16;
6254 const bool widthSet = !differentFont && tab->icon.isNull();
6257 sz.
rwidth() = textSize.width();
6258 sz.
rheight() =
qMax(defaultTabHeight, textSize.height());
6267 int maxWidgetHeight =
qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
6268 int maxWidgetWidth =
qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
6270 int widgetWidth = 0;
6271 int widgetHeight = 0;
6273 if (tab->leftButtonSize.isValid()) {
6275 widgetWidth += tab->leftButtonSize.width();
6276 widgetHeight += tab->leftButtonSize.height();
6278 if (tab->rightButtonSize.isValid()) {
6280 widgetWidth += tab->rightButtonSize.width();
6281 widgetHeight += tab->rightButtonSize.height();
6296 bool isFlat =
false;
6309 if (macsz.width() != -1)
6338 int maxpmw = mi->maxIconWidth;
6339#if QT_CONFIG(combobox)
6348 h = mi->fontMetrics.height() + 2;
6349 if (!mi->icon.isNull()) {
6350#if QT_CONFIG(combobox)
6371#if QT_CONFIG(combobox)
6372 if (comboBox && comboBox->
isVisible()) {
6375 cmb.editable =
false;
6396 if (
const auto *tb = qstyleoption_cast<const QStyleOptionToolButton *>(
opt))
6401 if (
const auto *
cb = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
6402 const auto controlSize =
d->effectiveAquaSizeConstrain(
opt,
widget);
6403 if (!
cb->editable) {
6430 if (
proxy() ==
this) {
6437 sz = menuMask.region.boundingRect().size();
6444 useAquaGuideline =
false;
6448 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
6449 const int minimumSize = 24;
6456#if QT_CONFIG(itemviews)
6458 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
6473 if (macsz.width() != -1)
6475 if (macsz.height() != -1)
6483 if (combo->editable) {
6484 const auto widgetSize =
d->aquaSizeConstrain(
opt,
widget);
6487 cw.size = widgetSize;
6510#if QT_CONFIG(graphicsview)
6511 if (
QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusWidget)) {
6515 if (
proxy->widget())
6516 focusWidget =
proxy->widget()->focusWidget();
6522#if QT_CONFIG(spinbox)
6523 if (
const auto sb = qobject_cast<QAbstractSpinBox *>(focusWidget))
6530 if (!
d->focusWidget)
6532 d->focusWidget->setWidget(
f);
6533 }
else if (
d->focusWidget) {
6534 d->focusWidget->setWidget(0);
6538 d->focusWidget->setWidget(0);
6557 p.translate(pix2.
width(), 0);
6606 switch (
CT2(control1, control2)) {
struct capHdr __attribute__
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.
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
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.
float redF() const noexcept
Returns the red color component of this color.
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...
The QComboBox widget combines a button with a dropdown 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.
Type type() const
Returns the event type.
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
\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.
static QFontPrivate * get(const QFont &font)
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
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.
int height() const
Returns the height of the image.
@ Format_ARGB32_Premultiplied
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
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.
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
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(QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
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 Q_CORE_EXPORT QOperatingSystemVersionBase current()
static constexpr QOperatingSystemVersionBase MacOSCatalina
\variable QOperatingSystemVersion::MacOSCatalina
static constexpr QOperatingSystemVersionBase MacOSMojave
\variable QOperatingSystemVersion::MacOSMojave
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 setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
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 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
\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 QRect toRect() const noexcept
Returns a QRect based on the values of this 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 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 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 setLeft(int pos) noexcept
Sets the left edge of the rectangle to 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 moveTo(int x, int t) noexcept
Moves the rectangle, leaving the top-left corner at the given position (x, y).
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.
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
constexpr void setHeight(qreal h) noexcept
Sets the height to the given finite height.
constexpr qreal width() const noexcept
Returns the width.
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 left(qsizetype n) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
qsizetype length() const noexcept
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
\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 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_ToolBarExtensionExtent
@ PM_TabCloseIndicatorHeight
@ 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.
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
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 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 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)
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
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
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