15#include <QtQuickTemplates2/private/qquickcontrol_p.h>
17#define QMAC_QAQUASTYLE_SIZE_CONSTRAIN
20#include <QtCore/qoperatingsystemversion.h>
21#include <QtCore/qvariant.h>
22#include <QtCore/qvarlengtharray.h>
24#include <QtGui/qpainterpath.h>
25#include <QtGui/qpa/qplatformnativeinterface.h>
26#include <QtGui/qpa/qplatformfontdatabase.h>
27#include <QtGui/qpa/qplatformtheme.h>
29#include <QtCore/private/qcore_mac_p.h>
30#include <QtGui/private/qcoregraphics_p.h>
31#include <QtGui/private/qguiapplication_p.h>
41#undef QT_MANGLE_NAMESPACE
42#undef QT_NAMESPACE_ALIAS_OBJC_CLASS
44#define QQC2_MANGLE1(a, b) a##_##b
45#define QQC2_MANGLE2(a, b) QQC2_MANGLE1(a, b)
47#if defined(QT_NAMESPACE)
48 #define QT_MANGLE_NAMESPACE(name) QQC2_MANGLE2(QQC2_MANGLE1(name, QQC2_NAMESPACE), QT_NAMESPACE)
49 #define QT_NAMESPACE_ALIAS_OBJC_CLASS(name) @compatibility_alias name QT_MANGLE_NAMESPACE(name)
51 #define QT_MANGLE_NAMESPACE(name) QQC2_MANGLE2(name, QQC2_NAMESPACE)
52 #define QT_NAMESPACE_ALIAS_OBJC_CLASS(name) @compatibility_alias name QT_MANGLE_NAMESPACE(name)
74 if ((self = [super
init])) {
76 self.indeterminate = YES;
77 self.usesThreadedAnimation = NO;
78 self.alphaValue = 0.0;
86 if (_animators == 0) {
88 [
super startAnimation:self];
96 if (_animators == 0) {
97 [
super stopAnimation:self];
99 [
self removeFromSuperviewWithoutNeedingDisplay];
103- (
void)drawWithFrame:(CGRect)rect inView:(NSView *)view
106 self.alphaValue = 1.0;
108 [view addSubview:self];
109 if (!CGRectEqualToRect(
self.frame,
rect))
111 [
self drawRect:rect];
112 self.alphaValue = 0.0;
139 if ((self = [super
init])) {
141 self.titlePosition = NSNoTitle;
142 self.boxType = NSBoxCustom;
143 self.cornerRadius = 3;
144 self.borderColor = [NSColor.controlColor colorWithAlphaComponent:0.1];
145 self.fillColor = [NSColor.darkGrayColor colorWithAlphaComponent:0.2];
151- (
void)drawRect:(NSRect)rect
153 [
super drawRect:rect];
190bool isDarkMode() {
return qt_mac_applicationIsInDarkMode(); }
230#ifndef QT_NO_ACCESSIBILITY
237 return isOnKeyWindow ?
QColor(73, 73, 73, 100) :
QColor(56, 56, 56, 100);
239 return isOnKeyWindow ?
QColor(0, 0, 0, 28) :
QColor(0, 0, 0, 21);
279#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
281 && !qt_mac_applicationIsInDarkMode()) {
282 auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name;
283 if (![NSAppearance.currentAppearance.name isEqualToString:requiredAppearanceName]) {
284 previous = NSAppearance.currentAppearance;
285 NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName];
294 NSAppearance.currentAppearance = previous;
298 NSAppearance *previous = nil;
305 const qreal length = sb->maximum - sb->minimum + sb->pageStep;
314 scroller.frame = sb->rect.toCGRect();
316 scroller.knobProportion = proportion;
320static bool setupSlider(NSSlider *slider,
const QStyleOptionSlider *sl)
322 if (sl->minimum >= sl->maximum)
328 [slider initWithFrame:sl->rect.toCGRect()];
330 slider.minValue = sl->minimum;
331 slider.maxValue = sl->maximum;
332 slider.intValue = sl->sliderPosition;
334 if (sl->tickPosition != QStyleOptionSlider::NoTicks) {
336 int interval = sl->tickInterval;
338 interval = sl->pageStep;
340 interval = sl->singleStep;
344 slider.numberOfTickMarks = 1 + ((sl->maximum - sl->minimum) / interval);
346 const bool ticksAbove = sl->tickPosition == QStyleOptionSlider::TicksAbove;
348 slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionAbove : NSTickMarkPositionBelow;
350 slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionLeading : NSTickMarkPositionTrailing;
352 slider.numberOfTickMarks = 0;
357 [slider layoutSubtreeIfNeeded];
360 const CGRect knobRect = [slider.cell knobRectFlipped:slider.isFlipped];
362 pressPoint.x = CGRectGetMidX(knobRect);
363 pressPoint.y = CGRectGetMidY(knobRect);
364 [slider.cell startTrackingAt:pressPoint inView:slider];
372 const auto tabDirection = QMacStylePrivate::tabDirection(shape);
373 if (QMacStylePrivate::verticalTabs(tabDirection)) {
374 int newX, newY, newRot;
376 newX = tabRect.
width();
381 newY = tabRect.
y() + tabRect.
height();
396 if (QMacStylePrivate::verticalTabs(QMacStylePrivate::tabDirection(tabOpt->shape)))
399 rect =
rect.adjusted(0, -tabOverlap, 0, 0);
416 if (tabOpt->documentMode && isUnified) {
443 p->fillRect(leftLineRect, separatorLineColor);
444 p->fillRect(rightLineRect, separatorLineColor);
463 p->fillRect(bodyRect, bodyColor);
468 p->fillRect(topLineRect, topLineColor);
472 bool isDocument =
false;
476 p->fillRect(bottomLineRect, bottomLineColor);
493 int l = original.
length();
500 }
else if (original.
at(currPos) ==
QLatin1Char(
'(') && l >= 4 &&
506 while (finalDest >
n && returnText.at(finalDest -
n - 1).isSpace())
513 returnText[finalDest] = original.
at(currPos);
518 returnText.truncate(finalDest);
525 if (NSWindow *nswindow =
static_cast<NSWindow*
>(
529 return [nswindow isMainWindow];
535#define LargeSmallMini(option, large, small, mini) \
536 (option->state & QStyle::State_Small) ? small : ((option->state & QStyle::State_Mini) ? mini : large)
646 qDebug(
"Not sure how to return this...");
780 if (szHint ==
QSize(-1, -1)) {
820 const QStyleOptionSlider *sld = qstyleoption_cast<const QStyleOptionSlider *>(
opt);
826 if (sld->tickPosition != QStyleOptionSlider::NoTicks)
830 if (sld->tickPosition != QStyleOptionSlider::NoTicks)
836 if (sld->tickPosition != QStyleOptionSlider::NoTicks)
840 if (sld->tickPosition != QStyleOptionSlider::NoTicks)
846 if (sld->tickPosition != QStyleOptionSlider::NoTicks)
850 if (sld->tickPosition != QStyleOptionSlider::NoTicks)
907 ret =
QSize(-1, [[NSApp mainMenu] menuBarHeight]);
912 if (
ret.height() <= 0)
925 static const qreal CornerPointOffset = 5.5;
926 static const qreal CornerControlOffset = 2.1;
930 path.moveTo(
r.left(),
r.top() + CornerPointOffset);
931 path.cubicTo(
r.left(),
r.top() + CornerControlOffset,
932 r.left() + CornerControlOffset,
r.top(),
933 r.left() + CornerPointOffset,
r.top());
935 path.lineTo(
r.right() - CornerPointOffset,
r.top());
936 path.cubicTo(
r.right() - CornerControlOffset,
r.top(),
937 r.right(),
r.top() + CornerControlOffset,
938 r.right(),
r.top() + CornerPointOffset);
940 path.lineTo(
r.right(),
r.bottom() - CornerPointOffset);
941 path.cubicTo(
r.right(),
r.bottom() - CornerControlOffset,
942 r.right() - CornerControlOffset,
r.bottom(),
943 r.right() - CornerPointOffset,
r.bottom());
945 path.lineTo(
r.left() + CornerPointOffset,
r.bottom());
946 path.cubicTo(
r.left() + CornerControlOffset,
r.bottom(),
947 r.left(),
r.bottom() - CornerControlOffset,
948 r.left(),
r.bottom() - CornerPointOffset);
949 path.lineTo(
r.left(),
r.top() + CornerPointOffset);
956 struct WindowButtons {
961 static const WindowButtons buttons[] = {
967 for (
const auto &wb : buttons)
981 ||
opt->shape == QStyleOptionTab::RoundedWest
982 ||
opt->shape == QStyleOptionTab::TriangularEast
983 ||
opt->shape == QStyleOptionTab::TriangularWest;
985 tr.setRect(0, 0,
tr.height(),
tr.width());
989 const int hpadding = 4;
991 if (
opt->shape == QStyleOptionTab::RoundedSouth ||
opt->shape == QStyleOptionTab::TriangularSouth)
992 verticalShift = -verticalShift;
993 tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
996 if (!
opt->leftButtonSize.isEmpty()) {
997 const int buttonSize =
verticalTabs ?
opt->leftButtonSize.height() :
opt->leftButtonSize.width();
998 tr.setLeft(
tr.left() + 4 + buttonSize);
1000 if (
opt->rightButtonSize.isEmpty())
1001 tr.setRight(
tr.right() - 4 - buttonSize);
1004 if (!
opt->rightButtonSize.isEmpty()) {
1005 const int buttonSize =
verticalTabs ?
opt->rightButtonSize.height() :
opt->rightButtonSize.width();
1006 tr.setRight(
tr.right() - 4 - buttonSize);
1008 if (
opt->leftButtonSize.isEmpty())
1009 tr.setLeft(
tr.left() + 4 + buttonSize);
1027 if (
opt->documentMode) {
1029 const int textWidth =
1031 *iconRect =
QRect(
tr.center().x() - textWidth / 2 - stylePadding - tabIconSize.width(),
1032 tr.center().y() - tabIconSize.height() / 2,
1033 tabIconSize.width(), tabIconSize.height());
1035 *iconRect =
QRect(
tr.left() + stylePadding,
tr.center().y() - tabIconSize.height() / 2,
1036 tabIconSize.width(), tabIconSize.height());
1041 tr.setLeft(
tr.left() + stylePadding + tabIconSize.width() + 4);
1042 tr.setRight(
tr.right() - stylePadding - tabIconSize.width() - 4);
1054 case QStyleOptionTab::RoundedSouth:
1055 case QStyleOptionTab::TriangularSouth:
1057 case QStyleOptionTab::RoundedNorth:
1058 case QStyleOptionTab::TriangularNorth:
1060 case QStyleOptionTab::RoundedWest:
1061 case QStyleOptionTab::TriangularWest:
1063 case QStyleOptionTab::RoundedEast:
1064 case QStyleOptionTab::TriangularEast:
1102 return ((
cw.type << 2) |
cw.size) ^
seed;
1143 const auto frameSize = defaultFrameSize();
1154 frameRect = frameRect.
adjusted(0, 0, -8, 0).translated(4, 4);
1162 frameRect = frameRect.
adjusted(0, 0, -6, 0).translated(3, 0);
1164 frameRect = frameRect.
adjusted(0, 0, -4, 0).translated(2, 1);
1166 frameRect = frameRect.
adjusted(0, 0, -9, 0).translated(5, 0);
1168 frameRect = frameRect.
adjusted(0, 0, -6, 0).translated(4, 0);
1205 *buttonType = NSButtonTypeSwitch;
1206 *bezelStyle = NSBezelStyleRegularSquare;
1209 *buttonType = NSButtonTypeOnOff;
1210 *bezelStyle = NSBezelStyleDisclosure;
1213 *buttonType = NSButtonTypeRadio;
1214 *bezelStyle = NSBezelStyleRegularSquare;
1217 *buttonType = NSButtonTypePushOnPushOff;
1218 *bezelStyle = NSBezelStyleShadowlessSquare;
1221 *buttonType = NSButtonTypePushOnPushOff;
1222 *bezelStyle = NSBezelStyleRounded;
1233 if (
const auto *
btn = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
1247 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
1248 if (combo->editable)
1263 CGRect innerBounds = outerBounds;
1268 switch (cocoaWidget.size) {
1270 innerBounds.origin.x += 3;
1271 innerBounds.origin.y += 3;
1272 innerBounds.size.width -= 6;
1273 innerBounds.size.height -= 7;
1276 innerBounds.origin.x += 2;
1277 innerBounds.origin.y += 2;
1278 innerBounds.size.width -= 5;
1279 innerBounds.size.height -= 6;
1283 innerBounds.origin.x += 2;
1284 innerBounds.origin.y += 2;
1285 innerBounds.size.width -= 5;
1286 innerBounds.size.height -= 6;
1288 }
else if (cocoaWidget.type ==
ComboBox) {
1289 switch (cocoaWidget.size) {
1291 innerBounds.origin.x += 3;
1292 innerBounds.origin.y += 3;
1293 innerBounds.size.width -= 7;
1294 innerBounds.size.height -= 8;
1297 innerBounds.origin.x += 3;
1298 innerBounds.origin.y += 3;
1299 innerBounds.size.width -= 4;
1300 innerBounds.size.height -= 8;
1304 innerBounds.origin.x += 3;
1305 innerBounds.origin.y += 2;
1306 innerBounds.size.width -= 6;
1307 innerBounds.size.height -= 8;
1328 ret =
ret.adjusted(0, 0, -22, 0).translated(2, 3);
1332 ret =
ret.adjusted(0, 0, -19, 0).translated(2, 2.5);
1333 ret.setHeight(10.5);
1341 ret.adjust(10, 1, -23, -4);
1344 ret.adjust(10, 4, -20, -3);
1347 ret.adjust(9, 0, -19, 0);
1361 smallSystemFont = *ssf;
1363 miniSystemFont = *msf;
1382 if (__builtin_available(macOS 10.14, *)) {
1383 if (qt_mac_applicationIsInDarkMode()) {
1394 NSBox *
box = [[NSBox alloc] init];
1397 box.titlePosition = NSNoTitle;
1408 NSButton *bc = [[NSButton alloc] init];
1416 NSPopUpButton *bc = [[NSPopUpButton alloc] init];
1426 const NSWindowButton
button = [=] {
1429 return NSWindowCloseButton;
1431 return NSWindowMiniaturizeButton;
1433 return NSWindowZoomButton;
1439 const auto styleMask = NSWindowStyleMaskTitled
1440 | NSWindowStyleMaskClosable
1441 | NSWindowStyleMaskMiniaturizable
1442 | NSWindowStyleMaskResizable;
1443 bv = [NSWindow standardWindowButton:button forStyleMask:styleMask];
1448 bv = [[NSComboBox alloc] init];
1451 bv = [[NSProgressIndicator alloc] init];
1457 bv = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
1462 bv = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
1465 bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
1470 bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
1473 bv = [[NSSplitView alloc] init];
1479 bv = [[NSTextField alloc] init];
1485 if ([bv isKindOfClass:[NSControl class]]) {
1486 auto *ctrl =
static_cast<NSControl *
>(bv);
1489 ctrl.controlSize = NSControlSizeSmall;
1492 ctrl.controlSize = NSControlSizeMini;
1499 auto *pi =
static_cast<NSProgressIndicator *
>(bv);
1503 pi.controlSize = NSControlSizeSmall;
1506 pi.controlSize = NSControlSizeMini;
1516 NSButtonType buttonType;
1517 NSBezelStyle bezelStyle;
1518 if (
cocoaControl.getCocoaButtonTypeAndBezelStyle(&buttonType, &bezelStyle)) {
1521 auto *
button =
static_cast<NSButton *
>(bv);
1522 button.buttonType = buttonType;
1523 button.bezelStyle = bezelStyle;
1525 button.allowsMixedState = YES;
1537 cell = [[NSStepperCell alloc] init];
1540 NSButtonCell *bc = [[NSButtonCell alloc] init];
1541 bc.buttonType = NSButtonTypeOnOff;
1542 bc.bezelStyle = NSBezelStyleDisclosure;
1552 cell.controlSize = NSControlSizeSmall;
1555 cell.controlSize = NSControlSizeMini;
1582 view.wantsLayer = YES;
1600 const CGRect dirtyRect =
rect.toCGRect();
1603 drawRectBlock(
ctx, dirtyRect);
1605 [view drawRect:dirtyRect];
1607 [view removeFromSuperviewWithoutNeedingDisplay];
1623 NSPreferredScrollerStyleDidChangeNotification, []() {
1632#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
1638 for (NSView *
b :
d->cocoaControls)
1640 d->cocoaControls.clear();
1668 case PM_DialogButtonsSeparator:
1671 case PM_DialogButtonsButtonHeight: {
1674 if (sz ==
QSize(-1, -1))
1679 case PM_DialogButtonsButtonWidth: {
1682 if (sz ==
QSize(-1, -1))
1733 if (qstyleoption_cast<const QStyleOptionComboBox *>(
opt) != 0)
1758 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
1759 int space = (sl->orientation ==
Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
1760 int ticks = sl->tickPosition;
1762 if (ticks & QStyleOptionSlider::TicksAbove)
1764 if (ticks & QStyleOptionSlider::TicksBelow)
1772 if (ticks != QStyleOptionSlider::TicksBothSides && ticks != QStyleOptionSlider::NoTicks)
1777 thick += (space * 2) / (
n + 2);
1802 ret = int([NSWindow frameRectForContentRect:NSZeroRect
1803 styleMask:style].size.height);
1806 switch (
d->aquaSizeConstrain(
opt)) {
1817 const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(
opt);
1818 if (tb && tb->documentMode)
1839 switch (
d->aquaSizeConstrain(
opt)) {
1854 ret =
static_cast<int>([NSScroller
1855 scrollerWidthForControlSize:static_cast<NSControlSize>(size)
1856 scrollerStyle:[NSScroller preferredScrollerStyle]]);
1859 switch (
d->aquaSizeConstrain(
opt)) {
1873 switch (
d->aquaSizeConstrain(
opt)) {
1888 switch (
d->aquaSizeConstrain(
opt)) {
1902 switch (
d->aquaSizeConstrain(
opt)) {
2009 case PM_PushButtonFocusFrameRadius:
2012 case PM_CheckBoxFocusFrameRadius:
2015 case PM_ComboBoxFocusFrameRadius:
2018 case PM_RadioButtonFocusFrameRadius:
2021 case PM_SliderFocusFrameRadius:
2028 case PM_DialFocusFrameRadius:
2029 case PM_SpinBoxFocusFrameRadius:
2030 case PM_TextAreaFocusFrameRadius:
2031 case PM_TextFieldFocusFrameRadius:
2114 NSUserDefaults*
defaults = [NSUserDefaults standardUserDefaults];
2115 bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
2154 if (
const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
2162 ret = !cmb->editable;
2209 const uchar fillR = 192, fillG = 191, fillB = 190;
2213 if (!pixmapSize.isEmpty()) {
2224 const int w = sbpl/4,
h =
img.height();
2227 QRgb *dptr = (
QRgb*)img_mask.bits(), *drow;
2228 const qsizetype dbpl = img_mask.bytesPerLine();
2230 for (
int y = 0;
y <
h; ++
y) {
2231 srow = sptr+((
y*sbpl)/4);
2232 drow = dptr+((
y*dbpl)/4);
2233 for (
int x = 0;
x <
w; ++
x) {
2234 const int redDiff =
qRed(*srow) - fillR;
2235 const int greenDiff =
qGreen(*srow) - fillG;
2236 const int blueDiff =
qBlue(*srow) - fillB;
2237 const int diff = (redDiff * redDiff) + (greenDiff * greenDiff) + (blueDiff * blueDiff);
2238 (*drow++) = (diff < 10) ? 0xffffffff : 0xff000000;
2294 case SH_SpellCheckUnderlineStyle:
2325 ret = QStyleOptionTabBarBase::LeftSide;
2363 int imgw =
img.width();
2365 for (
int y = 0;
y < imgh; ++
y) {
2366 for (
int x = 0;
x < imgw; ++
x) {
2367 pixel =
img.pixel(
x,
y);
2388 static bool recursionGuard =
false;
2393 recursionGuard =
true;
2395 recursionGuard =
false;
2397 switch (standardPixmap) {
2417 d->resolveCurrentNSView(
opt->window);
2426 const int xOffset = 1;
2428 const qreal penWidth =
qMax(halfSize / 3.0, 1.25);
2457 path.moveTo(-halfSize, -halfSize * 0.5);
2458 path.lineTo(0.0, halfSize * 0.5);
2459 path.lineTo(halfSize, -halfSize * 0.5);
2463 p->strokePath(
path, arrowPen);
2467 if (
const QStyleOptionTabBarBase *tbb
2468 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
2469 if (tbb->documentMode) {
2476 region -= tbb->tabBarRect;
2478 p->setClipRegion(region);
2479 QStyleOptionTabWidgetFrame twf;
2480 twf.QStyleOption::operator=(*tbb);
2481 twf.shape = tbb->shape;
2482 switch (QMacStylePrivate::tabDirection(twf.shape)) {
2484 twf.rect = twf.rect.adjusted(0, 0, 0, 10);
2487 twf.rect = twf.rect.adjusted(0, -10, 0, 0);
2490 twf.rect = twf.rect.adjusted(0, 0, 10, 0);
2493 twf.rect = twf.rect.adjusted(0, -10, 0, 0);
2504 if (
const auto *
groupBox = qstyleoption_cast<const QStyleOptionFrame *>(
opt))
2513 auto *
box =
static_cast<NSBox *
>(
d->cocoaControl(
cw));
2527 auto adjustedRect =
opt->
rect;
2528 bool needTranslation =
false;
2530 && !qt_mac_applicationIsInDarkMode()) {
2542 adjustedRect.
adjust(0, 0, 6, 6);
2543 needTranslation =
true;
2551 CGContextTranslateCTM(
ctx, 0,
rect.origin.y +
rect.size.height);
2552 CGContextScaleCTM(
ctx, 1, -1);
2555 [box drawRect:rect];
2557 if (needTranslation)
2558 CGContextTranslateCTM(
ctx, -3.0, 5.0);
2559 [box displayRectIgnoringOpacity:box.bounds inContext:NSGraphicsContext.currentContext];
2577 theStroker.setDashPattern(QVector<qreal>() << 1 << 2);
2578 path = theStroker.createStroke(
path);
2581 p->fillPath(
path, dark);
2599 p->setPen(
QColor(160, 160, 160));
2602 p->setPen(
QColor(145, 145, 145));
2612 static const int RectHeight = 2;
2614 while (y < opt->
rect.height() - RectHeight - 5) {
2616 path.addEllipse(
x,
y, RectHeight, RectHeight);
2620 while (x < opt->
rect.width() - RectHeight - 5) {
2622 path.addEllipse(
x,
y, RectHeight, RectHeight);
2629 p->fillPath(
path, dark);
2638 proxy()->drawPrimitive(
2650 QCFType<CGColorRef> checkmarkColor = CGColorCreateGenericRGB(
static_cast<CGFloat>(pc.
redF()),
2661 kCTFontUIFontMenuItemMark;
2666 QCFType<CTFontRef> checkmarkFont = CTFontCreateUIFontForLanguage(
fontType,
fontSize, NULL);
2668 CGContextSaveGState(cg);
2669 CGContextSetShouldSmoothFonts(cg, NO);
2677 CGContextScaleCTM(cg, 1, -1);
2679 CGContextTranslateCTM(cg,
opt->
rect.
x(), vOffset);
2683 static const CFStringRef
keys[] = { kCTFontAttributeName, kCTForegroundColorAttributeName };
2684 static const int numValues =
sizeof(
keys) /
sizeof(
keys[0]);
2685 const CFTypeRef
values[] = { (CFTypeRef)checkmarkFont, (CFTypeRef)checkmarkColor };
2687 QCFType<CFDictionaryRef> attributes = CFDictionaryCreate(kCFAllocatorDefault, (
const void **)
keys, (
const void **)
values,
2688 numValues, NULL, NULL);
2690 QCFType<CFAttributedStringRef> checkmarkString = CFAttributedStringCreate(kCFAllocatorDefault, (CFStringRef)
@"\u2713", attributes);
2691 QCFType<CTLineRef>
line = CTLineCreateWithAttributedString(checkmarkString);
2693 CTLineDraw((CTLineRef)
line, cg);
2696 CGContextRestoreGState(cg);
2705 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
2707 auto *tb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
2708 tb.enabled = isEnabled;
2711 [tb highlight:isPressed];
2712 const auto vOffset = [=] {
2721 CGContextTranslateCTM(
ctx, 0, vOffset);
2722 [tb.cell drawInteriorWithFrame:rect inView:tb];
2732 NSButtonCell *triangleCell =
static_cast<NSButtonCell *
>(
d->cocoaCell(
cw));
2733 [triangleCell setState:(opt->state & State_Open) ? NSControlStateValueOn : NSControlStateValueOff];
2735 bool viewHasFocus =
false;
2736 [triangleCell setBackgroundStyle:((opt->state & State_Selected) && viewHasFocus) ? NSBackgroundStyleEmphasized : NSBackgroundStyleNormal];
2738 d->setupNSGraphicsContext(cg, NO);
2741 CGRect
rect = CGRectMake(qtRect.x() + 1, qtRect.y(), qtRect.width(), qtRect.height());
2742 CGContextTranslateCTM(cg,
rect.origin.x,
rect.origin.y +
rect.size.height);
2743 CGContextScaleCTM(cg, 1, -1);
2744 CGContextTranslateCTM(cg, -
rect.origin.x, -
rect.origin.y);
2746 [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]];
2748 d->restoreNSGraphicsContext(cg);
2752 const QPen oldPen =
p->pen();
2753 QPen penCpy =
p->pen();
2769 auto *tf =
static_cast<NSTextField *
>(
d->cocoaControl(
cw));
2770 tf.enabled = isEnabled;
2771 tf.editable = !isReadOnly;
2773 static_cast<NSTextFieldCell *
>(tf.cell).bezelStyle = isRounded ? NSTextFieldRoundedBezel : NSTextFieldSquareBezel;
2774 tf.frame =
opt->
rect.toCGRect();
2776 QMacAutoReleasePool pool;
2777 if (!qt_mac_applicationIsInDarkMode()) {
2782 CGContextRef cgContext = NSGraphicsContext.currentContext.CGContext;
2786 if (cgContext ? bool(CGBitmapContextGetColorSpace(cgContext)) : false) {
2787 tf.drawsBackground = YES;
2788 const QColor bgColor = frame->palette.brush(QPalette::Base).color();
2789 tf.backgroundColor = [NSColor colorWithSRGBRed:bgColor.redF()
2790 green:bgColor.greenF()
2791 blue:bgColor.blueF()
2792 alpha:bgColor.alphaF()];
2793 if (bgColor.alpha() != 255) {
2800 [tf.cell drawWithFrame:
rect inView:tf];
2875 int imgw =
img.width();
2878 for (
int y = 0;
y < imgh; ++
y) {
2879 for (
int x = 0;
x < imgw; ++
x) {
2880 pixel =
img.pixel(
x,
y);
2883 hsvColor.getHsv(&
h, &
s, &
v);
2886 hsvColor.setHsv(
h,
s,
v);
2887 pixel = hsvColor.rgb();
2897 CGContextTranslateCTM(cg,
rect.size.height, 0);
2898 CGContextRotateCTM(cg,
M_PI_2);
2900 if (vertical != reverse) {
2901 CGContextTranslateCTM(cg,
rect.size.width, 0);
2902 CGContextScaleCTM(cg, -1, 1);
2914 d->resolveCurrentNSView(
opt->window);
2922 p->fillRect(ir, pressed ?
header->palette.dark() :
header->palette.button());
2937 if (!
header->icon.isNull()) {
2943 opt->window->devicePixelRatio(),
mode);
2946 pixr.setY(
header->rect.center().y() - (
pixmap.height() /
pixmap.devicePixelRatio() - 1) / 2);
2948 textr.translate(
pixmap.width() /
pixmap.devicePixelRatio() + 2, 0);
2959 myTb.
state &= ~State_AutoRaise;
2960#ifndef QT_NO_ACCESSIBILITY
2961 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar)) {
2962 QRect cr = tb->rect;
2965 bool needText =
false;
2978 if (tb->icon.isNull() && !tb->text.isEmpty())
2994 QPixmap pixmap = tb->icon.pixmap(tb->rect.size().boundedTo(tb->iconSize),
2995 opt->window->devicePixelRatio(), iconMode,
3002 pr.setHeight(
pixmap.size().height() /
pixmap.devicePixelRatio() + 6);
3003 cr.
adjust(0, pr.bottom(), 0, -3);
3006 pr.setWidth(
pixmap.width() /
pixmap.devicePixelRatio() + 8);
3007 cr.
adjust(pr.right(), 0, 0, 0);
3012 pr.translate(shiftX, shiftY);
3031 QPen pen =
p->pen();
3078 d->autoDefaultButton =
nullptr;
3082 const bool isHighlighted =
isActive &&
3089 const auto cs =
d->effectiveAquaSizeConstrain(
btn);
3091 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3096 pb.frame = frameRect.toCGRect();
3098 pb.enabled = isEnabled;
3099 [pb highlight:isPressed];
3100 pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff;
3101 d->drawNSViewInRect(pb, frameRect,
p, ^(
CGContextRef,
const CGRect &
r) {
3103 [pb.cell drawBezelWithFrame:r inView:pb.superview];
3111 const auto ir = frameRect.
toRect();
3112 int arrowYOffset = 0;
3146 if ((!hasIcon && !hasMenu) || (hasIcon && !hasText)) {
3170 int pixmapHeight =
pixmap.height() /
pixmap.devicePixelRatio();
3172 int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2;
3173 int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmapHeight) / 2;
3174 QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmapWidth, pixmapHeight);
3177 int newOffset = iconDestRect.x() + iconDestRect.width()
3191 if (
const auto *
cb = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
3192 auto comboCopy = *
cb;
3199 if (
const auto *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
3200 if (tabOpt->documentMode) {
3202 bool isUnified =
false;
3220 const auto tabDirection = QMacStylePrivate::tabDirection(tabOpt->shape);
3224 QStyleOptionTab::TabPosition tp = tabOpt->position;
3225 QStyleOptionTab::SelectedPosition
sp = tabOpt->selectedPosition;
3227 if (tp == QStyleOptionTab::Beginning)
3228 tp = QStyleOptionTab::End;
3229 else if (tp == QStyleOptionTab::End)
3230 tp = QStyleOptionTab::Beginning;
3232 if (
sp == QStyleOptionTab::NextIsSelected)
3233 sp = QStyleOptionTab::PreviousIsSelected;
3234 else if (
sp == QStyleOptionTab::PreviousIsSelected)
3235 sp = QStyleOptionTab::NextIsSelected;
3250 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
3252 const bool needsInactiveHack = (!
isActive && isSelected);
3253 const auto ct = !needsInactiveHack && (isSelected || tp == QStyleOptionTab::OnlyOneTab) ?
3258 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3260 auto vOffset = isPopupButton ? 1 : 2;
3263 const auto outerAdjust = isPopupButton ? 1 : 4;
3264 const auto innerAdjust = isPopupButton ? 20 : 10;
3265 QRectF frameRect = tabOpt->rect;
3269 frameRect = frameRect.
translated(0, vOffset);
3271 case QStyleOptionTab::Beginning:
3274 frameRect = frameRect.
adjusted(-innerAdjust, 0, outerAdjust, 0);
3276 frameRect = frameRect.
adjusted(-outerAdjust, 0, innerAdjust, 0);
3278 case QStyleOptionTab::Middle:
3279 frameRect = frameRect.
adjusted(-innerAdjust, 0, innerAdjust, 0);
3281 case QStyleOptionTab::End:
3284 frameRect = frameRect.
adjusted(-innerAdjust, 0, outerAdjust, 0);
3286 frameRect = frameRect.
adjusted(-outerAdjust, 0, innerAdjust, 0);
3288 case QStyleOptionTab::OnlyOneTab:
3289 frameRect = frameRect.
adjusted(-outerAdjust, 0, outerAdjust, 0);
3292 pb.frame = frameRect.toCGRect();
3294 pb.enabled = isEnabled;
3295 [pb highlight:isPressed];
3297 pb.state = (
isActive && isSelected && !isPressed) ? NSControlStateValueOn : NSControlStateValueOff;
3301 CGContextClipToRect(
ctx,
opt->
rect.toCGRect());
3302 if (!isSelected || needsInactiveHack) {
3306 CGContextScaleCTM(
ctx, -1, 1);
3307 CGContextTranslateCTM(
ctx, -frameRect.
left(), 0);
3310 CGContextScaleCTM(
ctx, 1, -1);
3311 CGContextTranslateCTM(
ctx, 0, -frameRect.
right());
3314 CGContextScaleCTM(
ctx, 1, -1);
3315 CGContextTranslateCTM(
ctx, 0, -frameRect.
left());
3322 CGContextTranslateCTM(
ctx, 0, frameRect.
right());
3324 CGContextTranslateCTM(
ctx, -frameRect.
left(), 0);
3332 NSPopUpArrowPosition
oldPosition = NSPopUpArrowAtCenter;
3333 NSPopUpButtonCell *pbCell = nil;
3334 if (isPopupButton) {
3335 pbCell =
static_cast<NSPopUpButtonCell *
>(pb.cell);
3337 pbCell.arrowPosition = NSPopUpNoArrow;
3340 [pb.cell drawBezelWithFrame:r inView:pb.superview];
3346 if (needsInactiveHack) {
3348 const qreal pixelRatio =
p->device()->devicePixelRatioF();
3350 tabPixmap.setDevicePixelRatio(pixelRatio);
3353 d->drawNSViewInRect(pb, frameRect, &tabPainter, ^(
CGContextRef ctx,
const CGRect &
r) {
3356 drawBezelBlock(
ctx,
r);
3361 const qreal inactiveGray = 0.898;
3362 const int inactiveGray8 =
qRound(inactiveGray * 255.0);
3363 const QRgb inactiveGrayRGB =
qRgb(inactiveGray8, inactiveGray8, inactiveGray8);
3364 for (
int l = 0; l < tabPixmap.height(); ++l) {
3365 auto *
line =
reinterpret_cast<QRgb*
>(tabPixmap.scanLine(l));
3366 for (
int i = 0;
i < tabPixmap.width(); ++
i) {
3368 line[i] = inactiveGrayRGB;
3377 p->drawImage(
opt->
rect, tabPixmap);
3379 d->drawNSViewInRect(pb, frameRect,
p, drawBezelBlock);
3382 if (!isSelected &&
sp != QStyleOptionTab::NextIsSelected
3383 && tp != QStyleOptionTab::End
3384 && tp != QStyleOptionTab::OnlyOneTab) {
3387 p->setOpacity(isEnabled ? 0.105 : 0.06);
3388 p->setPen(separatorPen);
3404 if (
const auto *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
3405 QStyleOptionTab myTab = *tab;
3406 const auto tabDirection = QMacStylePrivate::tabDirection(tab->shape);
3415 const bool nonDefaultFont =
false;
3427 int heightOffset = 0;
3430 }
else if (nonDefaultFont) {
3431 if (
p->fontMetrics().height() == myTab.rect.height())
3434 myTab.rect.setHeight(myTab.rect.height() + heightOffset);
3440 if (
const auto *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(
opt)) {
3441 const bool isVertical = dwOpt->verticalTitleBar;
3445 p->
translate(effectiveRect.left(), effectiveRect.top() + effectiveRect.width());
3447 p->translate(-effectiveRect.left(), -effectiveRect.top());
3455 p->drawLine(effectiveRect.bottomLeft(), effectiveRect.bottomRight());
3457 if (!dwOpt->title.isEmpty()) {
3461 effectiveRect.top() + titleRect.left() -
opt->
rect.
left(),
3465 const auto text =
p->fontMetrics().elidedText(dwOpt->title,
Qt::ElideRight, titleRect.width());
3506 p->fillRect(mi->rect, mi->palette.highlight());
3512 p->drawLine(mi->rect.x() + 2, mi->rect.y() + mi->rect.height() / 2 - 1,
3513 mi->rect.x() + mi->rect.width() - 4,
3514 mi->rect.y() + mi->rect.height() / 2 - 1);
3516 p->drawLine(mi->rect.x() + 2, mi->rect.y() + mi->rect.height() / 2,
3517 mi->rect.x() + mi->rect.width() - 4,
3518 mi->rect.y() + mi->rect.height() / 2);
3521 const int scrollerVOffset = 5;
3522 const int left = mi->rect.x() + (mi->rect.width() - scrollerSize.width()) / 2;
3523 const int right =
left + scrollerSize.width();
3527 bottom = mi->rect.y() + scrollerVOffset;
3530 bottom = mi->rect.bottom() - scrollerVOffset;
3546 CGColorRef separatorColor = [NSColor quaternaryLabelColor].CGColor;
3547 const QRect separatorRect =
QRect(mi->rect.left(), mi->rect.center().y(), mi->rect.width(), 2);
3552 const int maxpmw = mi->maxIconWidth;
3555 int xpos = mi->rect.x() + 18;
3556 int checkcol = maxpmw;
3558 p->setPen(mi->palette.text().color());
3560 p->setPen(mi->palette.highlightedText().color());
3562 p->setPen(mi->palette.buttonText().color());
3571 checkmarkOpt.rect =
QRect(xp, mi->rect.y() - checkmarkOpt.fontMetrics.descent(), mw, mh);
3573 checkmarkOpt.state.setFlag(
State_On, active);
3586 if (!mi->icon.isNull()) {
3599 int pixh =
pixmap.height() /
pixmap.devicePixelRatio();
3600 QRect cr(xpos, mi->rect.y(), checkcol, mi->rect.height());
3601 QRect pmr(0, 0, pixw, pixh);
3602 pmr.moveCenter(cr.
center());
3603 p->drawPixmap(pmr.topLeft(),
pixmap);
3610 int yPos = mi->rect.y();
3615 const int tabwidth = isSubMenu ? 9 : mi->tabWidth;
3623 if (tabIndex >= 0) {
3625 rightMarginText =
s.mid(tabIndex + 1);
3626 s =
s.left(tabIndex);
3630 if (!rightMarginText.isEmpty()) {
3635 p->drawText(xp, yPos, tabwidth, mi->rect.height(), text_flags |
Qt::AlignRight, rightMarginText);
3640 QFont myFont = mi->font;
3651 const auto *fontEngine =
QFontPrivate::get(myFont)->engineForScript(QChar::Script_Common);
3658 NSFont *
f = (NSFont *)(CTFontRef)fontEngine->handle();
3661 const auto pc =
p->pen().color();
3662 NSColor *
c = [NSColor colorWithSRGBRed:pc.redF()
3670 d->setupNSGraphicsContext(cgCtx, YES);
3676 [s.toNSString() drawAtPoint:CGPointMake(xpos, yPos)
3677 withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c,
3678 NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0]}];
3680 d->restoreNSGraphicsContext(cgCtx);
3683 p->drawText(xpos, yPos, mi->rect.width() - xm - tabwidth + 1,
3684 mi->rect.height(), text_flags,
s);
3694 const QBrush bg = selected ? mi->palette.highlight() : mi->palette.window();
3695 p->fillRect(mi->rect, bg);
3700 if (!mi->icon.isNull()) {
3705 mi->icon.pixmap(
QSize(iconExtent, iconExtent),
3706 opt->window->devicePixelRatio(),
3723 const bool isIndeterminate = (pb->minimum == 0 && pb->maximum == 0);
3724 const bool inverted = pb->invertedAppearance;
3730 const CGRect cgRect =
rect.toCGRect();
3732 const auto aquaSize =
d->aquaSizeConstrain(
opt);
3738 if (isIndeterminate) {
3757 d->setupNSGraphicsContext(cg, NO);
3758 d->setupVerticalInvertedXform(cg, reverse,
false, cgRect);
3759 [ipi drawWithFrame:cgRect inView:d->backingStoreNSView];
3760 d->restoreNSGraphicsContext(cg);
3768 auto *pi =
static_cast<NSProgressIndicator *
>(
d->cocoaControl(
cw));
3771 d->setupVerticalInvertedXform(
ctx, reverse,
false,
rect);
3772 pi.minValue = pb->minimum;
3773 pi.maxValue = pb->maximum;
3774 pi.doubleValue = pb->progress;
3818 auto *sv =
static_cast<NSSplitView *
>(
d->cocoaControl(
cw));
3819 sv.frame =
opt->
rect.toCGRect();
3822 [sv drawDividerInRect:rect];
3825 QPen oldPen =
p->pen();
3835 if (
const QStyleOptionRubberBand *rubber = qstyleoption_cast<const QStyleOptionRubberBand *>(
opt)) {
3837 if (!rubber->opaque) {
3840 strokeColor.
setHsvF(0, 0, 0.86, 1.0);
3841 fillColor.
setHsvF(0, 0, 0.53, 0.25);
3843 p->fillRect(
opt->
rect, strokeColor);
3845 QPen oldPen =
p->pen();
3847 QPen pen(strokeColor);
3849 p->setBrush(fillColor);
3852 p->drawRect(adjusted);
3854 p->setBrush(oldBrush);
3862 const bool isDarkMode = qt_mac_applicationIsInDarkMode();
3905 linearGrad.setColorAt(0, mainWindowGradientBegin);
3906 linearGrad.setColorAt(1, mainWindowGradientEnd);
3907 p->fillRect(
opt->
rect, linearGrad);
3913 p->drawLine(toolbarRect.topLeft(), toolbarRect.topRight());
3915 p->drawLine(toolbarRect.bottomLeft(), toolbarRect.bottomRight());
3918 p->drawLine(toolbarRect.topLeft(), toolbarRect.bottomLeft());
3920 p->drawLine(toolbarRect.topRight(), toolbarRect.bottomRight());
3948 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
3952 if (vopt->features & QStyleOptionViewItem::HasDecoration)
3953 rect.adjust(-fw, 0, 0, 0);
3970 const auto cs =
d->effectiveAquaSizeConstrain(
btn);
3972 auto frameRect =
cw.adjustedControlFrame(
btn->
rect);
3973 frameRect -=
cw.titleMargins();
4026 if (
const QStyleOptionTabWidgetFrame *twf
4027 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4028 switch (twf->shape) {
4029 case QStyleOptionTab::RoundedNorth:
4030 case QStyleOptionTab::TriangularNorth:
4033 case QStyleOptionTab::RoundedSouth:
4034 case QStyleOptionTab::TriangularSouth:
4035 rect =
QRect(
QPoint(0, twf->rect.height() - twf->leftCornerWidgetSize.height()),
4036 twf->leftCornerWidgetSize);
4045 if (
const QStyleOptionTabWidgetFrame *twf
4046 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4047 switch (twf->shape) {
4048 case QStyleOptionTab::RoundedNorth:
4049 case QStyleOptionTab::TriangularNorth:
4050 rect =
QRect(
QPoint(twf->rect.width() - twf->rightCornerWidgetSize.width(), 0),
4051 twf->rightCornerWidgetSize);
4053 case QStyleOptionTab::RoundedSouth:
4054 case QStyleOptionTab::TriangularSouth:
4055 rect =
QRect(
QPoint(twf->rect.width() - twf->rightCornerWidgetSize.width(),
4056 twf->rect.height() - twf->rightCornerWidgetSize.height()),
4057 twf->rightCornerWidgetSize);
4067 if (
const auto *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4068 if (twf->lineWidth != 0) {
4069 switch (QMacStylePrivate::tabDirection(twf->shape)) {
4071 rect.adjust(+1, +14, -1, -1);
4074 rect.adjust(+1, +1, -1, -14);
4077 rect.adjust(+14, +1, -1, -1);
4080 rect.adjust(+1, +1, -14, -1);
4086 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4087 QRect dummyIconRect;
4088 d->tabLayout(tab, &
rect, &dummyIconRect);
4093 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4099 bool verticalTabs = tab->shape == QStyleOptionTab::RoundedEast
4100 || tab->shape == QStyleOptionTab::RoundedWest
4101 || tab->shape == QStyleOptionTab::TriangularEast
4102 || tab->shape == QStyleOptionTab::TriangularWest;
4105 if (tab->shape == QStyleOptionTab::RoundedSouth || tab->shape == QStyleOptionTab::TriangularSouth)
4106 verticalShift = -verticalShift;
4108 qSwap(horizontalShift, verticalShift);
4109 horizontalShift *= -1;
4110 verticalShift *= -1;
4112 if (tab->shape == QStyleOptionTab::RoundedWest || tab->shape == QStyleOptionTab::TriangularWest)
4113 horizontalShift = -horizontalShift;
4115 tr.adjust(0, 0, horizontalShift, verticalShift);
4118 tr.setBottom(
tr.bottom() - verticalShift);
4119 tr.setRight(
tr.right() - horizontalShift);
4123 int w =
size.width();
4124 int h =
size.height();
4125 int midHeight =
static_cast<int>(
qCeil(
float(
tr.height() -
h) / 2));
4126 int midWidth = ((
tr.width() -
w) / 2);
4128 bool atTheTop =
true;
4129 switch (tab->shape) {
4130 case QStyleOptionTab::RoundedWest:
4131 case QStyleOptionTab::TriangularWest:
4134 case QStyleOptionTab::RoundedEast:
4135 case QStyleOptionTab::TriangularEast:
4140 rect =
QRect(tab->rect.x() + hpadding, midHeight,
w,
h);
4142 rect =
QRect(tab->rect.right() -
w - hpadding, midHeight,
w,
h);
4147 rect =
QRect(midWidth,
tr.y() + tab->rect.height() - hpadding -
h,
w,
h);
4155 int leftPadding = 4;
4156 int rightPadding = 4;
4158 int bottomPadding = 0;
4180 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
4189 if (combo->editable)
4207 const bool isIndeterminate = (pb->minimum == 0 && pb->maximum == 0);
4210 if (isIndeterminate) {
4213 rect.adjust(1, 1, -1, -2);
4241 if (
const QStyleOptionSlider *sliderOpt
4242 = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4245 if (sliderOpt->tickPosition == QStyleOptionSlider::NoTicks)
4248 rect.adjust(3, 0, -3, 0);
4252 case SE_ScrollBarLayoutItem:
4253 if (
const QStyleOptionSlider *sliderOpt = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4275 qstyleoption_cast<const QStyleOptionGroupBox *>(
opt)) {
4285 delta =
SIZE(8, 4, 4);
4287 delta =
SIZE(15, 12, 12);
4295 if (
const QStyleOptionTabWidgetFrame *tabWidgetOpt =
4296 qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4302 rect = tabWidgetOpt->rect;
4303 if (tabWidgetOpt->shape == QStyleOptionTab::RoundedNorth)
4316 = qstyleoption_cast<const QStyleOptionDockWidget*>(
opt);
4317 bool canClose = dwOpt == 0 ? true : dwOpt->closable;
4318 bool canFloat = dwOpt == 0 ?
false : dwOpt->floatable;
4320 const bool verticalTitleBar = dwOpt->verticalTitleBar;
4324 if (verticalTitleBar)
4325 srect = srect.transposed();
4328 int right = srect.right();
4329 int left = srect.left();
4335 sz +=
QSize(buttonMargin, buttonMargin);
4336 if (verticalTitleBar)
4339 srect.center().y() - sz.
height()/2,
4341 left = closeRect.right() + 1;
4352 sz +=
QSize(buttonMargin, buttonMargin);
4353 if (verticalTitleBar)
4356 srect.center().y() - sz.
height()/2,
4358 left = floatRect.right() + 1;
4393 if (verticalTitleBar) {
4395 srect.top() + srect.right() -
rect.right(),
4422 CGContextSaveGState(cg);
4423 [NSGraphicsContext saveGraphicsState];
4425 [NSGraphicsContext setCurrentContext:
4426 [NSGraphicsContext graphicsContextWithCGContext:cg flipped:flipped]];
4431 [NSGraphicsContext restoreGraphicsState];
4432 CGContextRestoreGState(cg);
4441 d->resolveCurrentNSView(
opt->window);
4445 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4449 if (!drawTrack && !drawKnob)
4457 static const CGFloat knobWidths[] = { 7.0, 5.0, 5.0 };
4458 const auto cocoaSize =
d->effectiveAquaSizeConstrain(
opt);
4463 bool wasActive =
false;
4467 bool shouldExpand =
false;
4474 const QStyle::State oldState =
static_cast<QStyle::State
>(
styleObject->
property(
"_q_stylestate").
value<QStyle::State::Int>());
4482 oldPos != sb->sliderPosition ||
4483 oldMin != sb->minimum ||
4484 oldMax != sb->maximum ||
4485 oldRect != sb->rect ||
4486 oldState != sb->state ||
4487 oldActiveControls != sb->activeSubControls) {
4526 shouldExpand =
isTransient && (
opt->activeSubControls || wasActive);
4544 d->setupNSGraphicsContext(cg, NO );
4548 NSScroller *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
4551 const bool hasDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
4555 scroller.knobStyle = hasDarkBg? NSScrollerKnobStyleLight : NSScrollerKnobStyleDark;
4557 scroller.knobStyle = NSScrollerKnobStyleDefault;
4566 CGContextBeginTransparencyLayerWithRect(cg,
scroller.frame,
nullptr);
4567 CGContextSetAlpha(cg, opacity);
4573 CGRect trackRect =
scroller.bounds;
4575 trackRect.origin.y += expandOffset;
4577 trackRect.origin.x += expandOffset;
4578 [scroller drawKnobSlotInRect:trackRect highlight:NO];
4588 const CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:scroller.controlSize scrollerStyle:scroller.scrollerStyle];
4589 const CGFloat knobWidth = knobWidths[cocoaSize] * expandScale;
4591 const CGRect scrollerKnobRect = CGRectInset([
scroller rectForPart:NSScrollerKnob], 1, 1);
4592 const CGFloat knobLength = isHorizontal ? scrollerKnobRect.size.width : scrollerKnobRect.size.height;
4593 const CGFloat knobPos = isHorizontal ? scrollerKnobRect.origin.x : scrollerKnobRect.origin.y;
4594 const CGFloat knobOffset =
qRound((scrollerWidth + expandOffset - knobWidth) / 2.0);
4595 const CGFloat knobRadius = knobWidth / 2.0;
4598 knobRect = CGRectMake(knobPos, knobOffset, knobLength, knobWidth);
4600 knobRect = CGRectMake(knobOffset, knobPos, knobWidth, knobLength);
4601 QCFType<CGPathRef> knobPath = CGPathCreateWithRoundedRect(knobRect, knobRadius, knobRadius,
nullptr);
4602 CGContextAddPath(cg, knobPath);
4603 CGContextSetAlpha(cg, 0.5);
4604 CGColorRef knobColor = hasDarkBg ? NSColor.whiteColor.CGColor : NSColor.blackColor.CGColor;
4605 CGContextSetFillColorWithColor(cg, knobColor);
4606 CGContextFillPath(cg);
4608 [scroller drawKnob];
4615 CGContextSetBlendMode(cg, kCGBlendModePlusDarker);
4616 [scroller drawKnob];
4622 CGContextEndTransparencyLayer(cg);
4624 d->restoreNSGraphicsContext(cg);
4628 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4631 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
4633 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
4637 const bool hasTicks = sl->tickPosition != QStyleOptionSlider::NoTicks;
4638 const bool hasDoubleTicks = sl->tickPosition == QStyleOptionSlider::TicksBothSides;
4645 if (isPressed && drawKnob) {
4646 const CGRect knobRect = [slider.cell knobRectFlipped:slider.isFlipped];
4647 pressPoint.x = CGRectGetMidX(knobRect);
4648 pressPoint.y = CGRectGetMidY(knobRect);
4649 [slider.cell startTrackingAt:pressPoint inView:slider];
4655 NSSliderCell *cell = slider.cell;
4658 const CGRect barRect = [cell barRectFlipped:slider.isFlipped];
4664 [cell drawBarInside:barRect flipped:!isHorizontal];
4667 if (drawBar && hasTicks && drawTicks) {
4668 if (!hasDoubleTicks) {
4669 [cell drawTickMarks];
4672 slider.tickMarkPosition = NSTickMarkPositionAbove;
4673 [slider layoutSubtreeIfNeeded];
4674 [cell drawTickMarks];
4675 slider.tickMarkPosition = NSTickMarkPositionBelow;
4676 [slider layoutSubtreeIfNeeded];
4677 [cell drawTickMarks];
4679 slider.tickMarkPosition = NSTickMarkPositionLeading;
4680 [slider layoutSubtreeIfNeeded];
4681 [cell drawTickMarks];
4682 slider.tickMarkPosition = NSTickMarkPositionTrailing;
4683 [slider layoutSubtreeIfNeeded];
4684 [cell drawTickMarks];
4693 if (isPressed && drawKnob)
4694 [slider.cell stopTracking:pressPoint at:pressPoint inView:slider mouseIsUp:NO];
4698 if (
const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
4715 d->setupNSGraphicsContext(cg, NO);
4717 const auto aquaSize =
d->effectiveAquaSizeConstrain(
opt);
4719 NSStepperCell *cell =
static_cast<NSStepperCell *
>(
d->cocoaCell(
cw));
4722 const CGRect newRect = [cell drawingRectForBounds:updown.toCGRect()];
4726 const CGFloat x = CGRectGetMidX(newRect);
4727 const CGFloat y = upPressed ? -3 : 3;
4728 const CGPoint pressPoint = CGPointMake(
x,
y);
4731 if (upPressed || downPressed)
4732 [cell startTrackingAt:pressPoint inView:d->backingStoreNSView];
4734 [cell drawWithFrame:newRect inView:d->backingStoreNSView];
4736 if (upPressed || downPressed)
4737 [cell stopTracking:pressPoint at:pressPoint inView:d->backingStoreNSView mouseIsUp:NO];
4739 d->restoreNSGraphicsContext(cg);
4744 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
4749 const auto cs =
d->effectiveAquaSizeConstrain(combo);
4751 auto *cc =
static_cast<NSControl *
>(
d->cocoaControl(
cw));
4752 cc.enabled = isEnabled;
4753 QRectF frameRect =
cw.adjustedControlFrame(combo->rect);;
4756 auto *pb =
static_cast<NSPopUpButton *
>(cc);
4764 pb.frame = frameRect.toCGRect();
4765 [pb highlight:isPressed];
4766 d->drawNSViewInRect(pb, frameRect,
p, ^(
CGContextRef,
const CGRect &
r) {
4768 [pb.cell drawBezelWithFrame:r inView:pb.superview];
4772 auto *
cb =
static_cast<NSComboBox *
>(cc);
4773 const auto frameRect =
cw.adjustedControlFrame(combo->rect);
4774 cb.frame = frameRect.toCGRect();
4777 if (NSButtonCell *cell =
static_cast<NSButtonCell *
>([cc.cell qt_valueForPrivateKey:
@"_buttonCell"])) {
4778 cell.highlighted = isPressed;
4786 [cb.cell drawWithFrame:r inView:cb];
4792 if (
const auto *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(
opt)) {
4803 QPainterPath outerFramePath =
d->windowPanelPath(outerFrameRect);
4806 const auto frameAdjust = 1.0 /
p->device()->devicePixelRatioF();
4807 const auto innerFrameRect = outerFrameRect.adjusted(frameAdjust, frameAdjust, -frameAdjust, 0);
4808 QPainterPath innerFramePath =
d->windowPanelPath(innerFrameRect);
4819 for (
const auto sc : buttons) {
4820 const auto ct =
d->windowButtonCocoaControl(sc);
4822 auto *wb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
4823 wb.enabled = (sc & titlebar->subControls) &&
isActive;
4824 [wb highlight:(titlebar->state & State_Sunken) && (sc & titlebar->activeSubControls)];
4830 auto *wbCell =
static_cast<NSButtonCell *
>(wb.cell);
4831 [wbCell drawWithFrame:rect inView:wb];
4838 if (!titlebar->icon.isNull()) {
4844 p->drawPixmap(iconPos,
tr.y(),
4846 opt->window->devicePixelRatio(),
4850 if (!titlebar->text.isEmpty())
4857 = qstyleoption_cast<const QStyleOptionGroupBox *>(
opt)) {
4886 = qstyleoption_cast<const QStyleOptionToolButton *>(
opt)) {
4887#ifndef QT_NO_ACCESSIBILITY
4888 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar)) {
4892 arrowOpt.rect.setY(arrowOpt.rect.y() + arrowOpt.rect.height() / 2);
4893 arrowOpt.rect.setHeight(arrowOpt.rect.height() / 2);
4897 d->drawToolbarButtonArrow(tb,
p);
4900 NSView *
view =
reinterpret_cast<NSView *
>(
opt->window->winId());
4903 isKey = [view.window isKeyWindow];
4907 path.addRoundedRect(
QRectF(tb->rect.x(), tb->rect.y(), tb->rect.width(), tb->rect.height() + 4), 4, 4);
4915 auto bflags = tb->state;
4918 auto mflags = tb->state;
4928 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
4930 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
4931 pb.bezelStyle = NSBezelStyleShadowlessSquare;
4932 pb.frame =
opt->
rect.toCGRect();
4933 pb.buttonType = NSButtonTypePushOnPushOff;
4934 pb.enabled = isEnabled;
4935 [pb highlight:isPressed];
4936 pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff;
4940 [pb.cell drawBezelWithFrame:rect inView:pb];
4954 d->drawToolbarButtonArrow(tb,
p);
4965 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(
opt))
4966 QStyleHelper::drawDial(dial,
p);
4989 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4990 if (!sl->rect.contains(pt))
4993 const bool hasTicks = sl->tickPosition != QStyleOptionSlider::NoTicks;
4996 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
4998 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5002 NSSliderCell *cell = slider.cell;
5003 const auto barRect = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]);
5004 const auto knobRect = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]);
5005 if (knobRect.contains(pt)) {
5007 }
else if (barRect.contains(pt)) {
5009 }
else if (hasTicks) {
5015 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5016 if (!sb->rect.contains(pt)) {
5023 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
5025 auto *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5034 const auto knobRect = QRectF::fromCGRect([
scroller rectForPart:NSScrollerKnob]);
5037 if (pt.
x() < knobRect.left())
5039 else if (pt.
x() > knobRect.right())
5044 if (pt.
y() < knobRect.top())
5046 else if (pt.
y() > knobRect.bottom())
5068 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5070 const bool isReverseHorizontal = isHorizontal && (sb->direction ==
Qt::RightToLeft);
5072 NSScrollerPart part = NSScrollerNoPart;
5074 part = NSScrollerKnob;
5076 part = NSScrollerKnobSlot;
5080 part = NSScrollerDecrementPage;
5082 part = NSScrollerIncrementPage;
5086 if (part != NSScrollerNoPart) {
5088 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
5090 auto *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5092 ret = QRectF::fromCGRect([
scroller rectForPart:part]).toRect();
5097 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5098 const bool hasTicks = sl->tickPosition != QStyleOptionSlider::NoTicks;
5101 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
5103 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5107 NSSliderCell *cell = slider.cell;
5109 ret = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]).toRect();
5111 ret = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]).toRect();
5113 const auto tickMarkRect = QRectF::fromCGRect([cell rectOfTickMarkAtIndex:0]);
5115 ret =
QRect(sl->rect.left(), tickMarkRect.top(), sl->rect.width(), tickMarkRect.height());
5117 ret =
QRect(tickMarkRect.left(), sl->rect.top(), tickMarkRect.width(), sl->rect.height());
5128 if (
const auto *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(
opt)) {
5135 qreal labelWidth = titlebar->fontMetrics.horizontalAdvance(titlebar->text) + 1;
5136 qreal labelHeight = titlebar->fontMetrics.height();
5140 if (!titlebar->icon.isNull()) {
5149 labelWidth, labelHeight);
5151 const auto currentButton =
d->windowButtonCocoaControl(sc);
5160 auto *wb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
5161 if (ct == currentButton)
5162 buttonSize = QSizeF::fromCGSize(wb.frame.size);
5167 const auto vOffset = (
opt->
rect.
height() - buttonSize.height()) / 2.0;
5175 const auto cs =
d->effectiveAquaSizeConstrain(combo);
5185 editRect = combo->rect.
adjusted(15, 7, -25, -9);
5188 if (combo->editable)
5189 editRect = combo->rect.adjusted(15, 6, -22, -9);
5191 editRect = combo->rect.adjusted(15, 8, -22, -6);
5194 if (combo->editable)
5195 editRect = combo->rect.adjusted(15, 6, -20, -7);
5197 editRect = combo->rect.adjusted(15, 5, -22, -6);
5203 ret = editRect.toAlignedRect();
5206 ret = editRect.toAlignedRect();
5208 ret.setWidth(combo->rect.right() -
ret.right());
5211 if (combo->editable) {
5213 const int comboTop = combo->rect.top();
5216 qRound(inner.origin.x - combo->rect.left() + inner.size.width),
5217 editRect.bottom() - comboTop + 2);
5219 ret =
QRect(combo->rect.x() + 4 - 11,
5220 combo->rect.y() + 1,
5221 editRect.width() + 10 + 11,
5234 bool hasNoText = !checkable &&
groupBox->text.isEmpty();
5240 const bool fontIsSet =
false;
5243 const int margin = flat || hasNoText ? 0 : 9;
5248 const int tw =
qCeil(
s.width());
5249 const int h =
qCeil(fm.height());
5254 if (flat && checkable)
5255 labelRect.moveLeft(labelRect.left() + 4);
5260 int newSum = indicatorWidth + 1;
5261 int newLeft = labelRect.left() + (rtl ? -newSum : newSum);
5262 labelRect.moveLeft(newLeft);
5264 labelRect.moveTop(labelRect.top() + 3);
5266 labelRect.moveTop(labelRect.top() + 4);
5268 int newLeft = labelRect.left() - (rtl ? 3 : -3);
5269 labelRect.moveLeft(newLeft);
5270 labelRect.moveTop(labelRect.top() + 3);
5272 int newLeft = labelRect.left() - (rtl ? 3 : 2);
5273 labelRect.moveLeft(newLeft);
5274 labelRect.moveTop(labelRect.top() + 4);
5280 int left = rtl ? labelRect.right() - indicatorWidth : labelRect.left() - 1;
5281 int top = flat ?
ret.top() + 1 :
ret.top() + 5;
5299 ret.adjust(3, -5, -3, -4);
5301 ret.adjust(3, 3, -3, -4);
5312 if (
const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
5345 if (spin->buttonSymbols == QStyleOptionSpinBox::NoButtons)
5349 const int x = spin->rect.width() - spinner_w;
5350 ret.setRect(
x + spin->rect.x(),
y + spin->rect.y(), spinner_w, spinner_h);
5353 NSStepperCell *cell =
static_cast<NSStepperCell *
>(
d->cocoaCell(
cw));
5354 const CGRect outRect = [cell drawingRectForBounds:ret.toCGRect()];
5355 ret = QRectF::fromCGRect(outRect).toRect();
5359 ret.setHeight(
ret.height() / 2);
5370 ret.translate(0, adjust_y);
5375 ret = spin->rect.adjusted(fw, fw, -fw, -fw);
5377 ret.setWidth(spin->rect.width() - spinBoxSep - spinner_w);
5390#ifndef QT_NO_ACCESSIBILITY
5391 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar))
5394 ret.adjust(-1, 0, 0, 0);
5409 bool useAquaGuideline =
true;
5413 if (
const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
5415 const QSize minimumSize(20, 24);
5422 const int upAndDownTogetherHeight = buttonSize.height() * 2;
5423 sz +=
QSize(buttonSize.width(), upAndDownTogetherHeight);
5462 if (
const QStyleOptionTabWidgetFrame *twf
5463 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
5466 const int gapBetweenTabbarAndStackWidget = 2 + 14 - overlap;
5468 const auto tabDirection = QMacStylePrivate::tabDirection(twf->shape);
5471 extra =
QSize(2, gapBetweenTabbarAndStackWidget + 1);
5473 extra =
QSize(gapBetweenTabbarAndStackWidget + 1, 2);
5479 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
5482 const bool differentFont =
false;
5483 const auto tabDirection = QMacStylePrivate::tabDirection(tab->shape);
5489 int defaultTabHeight;
5490 const auto cs =
d->effectiveAquaSizeConstrain(
opt);
5493 if (tab->documentMode)
5494 defaultTabHeight = 24;
5496 defaultTabHeight = 21;
5499 defaultTabHeight = 18;
5502 defaultTabHeight = 16;
5508 const bool widthSet = !differentFont && tab->icon.isNull();
5511 sz.
rwidth() = textSize.width();
5512 sz.
rheight() =
qMax(defaultTabHeight, textSize.height());
5521 int maxWidgetHeight =
qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
5522 int maxWidgetWidth =
qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
5524 int widgetWidth = 0;
5525 int widgetHeight = 0;
5527 if (tab->leftButtonSize.isValid()) {
5529 widgetWidth += tab->leftButtonSize.width();
5530 widgetHeight += tab->leftButtonSize.height();
5532 if (tab->rightButtonSize.isValid()) {
5534 widgetWidth += tab->rightButtonSize.width();
5535 widgetHeight += tab->rightButtonSize.height();
5551 if (sz.
width() < 10)
5557 int leftPadding = 4;
5558 int rightPadding = 4;
5560 int bottomPadding = 0;
5568 sz.
rwidth() += leftPadding + rightPadding;
5569 sz.
rheight() += topPadding + bottomPadding;
5582 const auto controlSize =
d->effectiveAquaSizeConstrain(
opt,
CT_PushButton, sz, &macsz);
5584 if (macsz.width() != -1)
5601 int maxpmw = mi->maxIconWidth;
5613 h = mi->fontMetrics.height() + 2;
5614 if (!mi->icon.isNull()) {
5656 if (
const auto *tb = qstyleoption_cast<const QStyleOptionToolButton *>(
opt))
5661 if (
const auto *
cb = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
5665 if (sz.
width() < 10)
5668 if (!
cb->editable) {
5694 if (
proxy() ==
this) {
5701 sz = menuMask.region.boundingRect().size();
5708 useAquaGuideline =
false;
5712 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5713 const int minimumWidth = 24;
5714 const int absoluteHeight = 14;
5725 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
5738 if (macsz.width() != -1)
5740 if (macsz.height() != -1)
5748 if (combo->editable) {
5749 const auto widgetSize =
d->aquaSizeConstrain(
opt);
5752 cw.size = widgetSize;
5784 margins = QCommonStyle::ninePatchMargins(cc,
opt,
imageSize);
5812 p.translate(pix2.
width(), 0);
nonatomic NSInteger animators
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.
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 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
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
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.
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)
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
void setPointSizeF(qreal)
Sets the point size to pointSize.
int midLineWidth
the width of the mid-line
int lineWidth
the line width
Shape frameShape
the frame shape value from the frame style
static QPlatformTheme * platformTheme()
static QPlatformNativeInterface * platformNativeInterface()
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.
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 &
\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
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
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
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 MacOSMojave
\variable QOperatingSystemVersion::MacOSMojave
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.
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 & 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 setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
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.
NSView * backingStoreNSView
int styleHint(StyleHint sh, const QStyleOption *opt=0, QStyleHintReturn *shret=0) const override
int pixelMetric(PixelMetric pm, const QStyleOption *opt=0) const override
\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 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 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 int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QRegion class specifies a clip region for a painter.
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
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.
Qt::LayoutDirection direction
ContentsType
This enum describes the available contents types.
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_Menu_FlashTriggeredItem
@ SH_Menu_SubMenuPopupDelay
@ SH_ItemView_ArrowKeysNavigateIntoChildren
@ SH_Slider_AbsoluteSetButtons
@ SH_Menu_SubMenuResetWhenReenteringParent
@ SH_Header_ArrowAlignment
@ SH_ToolBox_SelectedPageTitleBold
@ SH_TabBar_PreferNoArrows
@ SH_Menu_SubMenuSloppySelectOtherActions
@ 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_ScrollBar_ContextMenu
@ SH_FormLayoutFormAlignment
@ SH_Menu_SubMenuDontStartSloppyOnLeave
@ SH_MessageBox_CenterButtons
@ SH_TitleBar_ModifyNotification
@ SH_Slider_StopMouseOverSlider
@ SH_SpinBox_ButtonsInsideFrame
@ SH_GroupBox_TextLabelVerticalAlignment
@ SH_PrintDialog_RightAlignButtons
@ SH_BlinkCursorWhenTextSelected
@ SH_ListViewExpand_SelectMouseType
@ SH_ItemView_EllipsisLocation
@ SH_MessageBox_TextInteractionFlags
@ SH_RichText_FullWidthSelection
@ SH_FormLayoutLabelAlignment
@ SH_ItemView_ShowDecorationSelected
@ SH_DockWidget_ButtonsHaveFrame
@ SH_Menu_SpaceActivatesItem
@ SH_FocusFrame_AboveWidget
@ SH_Workspace_FillSpaceOnMaximize
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment,...
virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const
Returns the area within the given rectangle in which to draw the provided text according to the speci...
StandardPixmap
This enum describes the available standard pixmaps.
@ SP_TitleBarNormalButton
@ SP_MessageBoxInformation
@ SP_ToolBarVerticalExtensionButton
@ SP_ToolBarHorizontalExtensionButton
ControlElement
This enum represents a control element.
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=nullptr) const =0
Returns the sub-area for the given element as described in the provided style option.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction.
PixelMetric
This enum describes the various available pixel metrics.
@ PM_DockWidgetFrameWidth
@ PM_DockWidgetTitleMargin
@ PM_ExclusiveIndicatorHeight
@ PM_ButtonShiftHorizontal
@ PM_MdiSubWindowFrameWidth
@ PM_DockWidgetTitleBarButtonMargin
@ PM_ScrollView_ScrollBarOverlap
@ PM_DockWidgetSeparatorExtent
@ PM_TabCloseIndicatorWidth
@ PM_CheckBoxLabelSpacing
@ PM_LayoutVerticalSpacing
@ PM_TabBarTabShiftVertical
@ PM_LayoutHorizontalSpacing
@ PM_ButtonDefaultIndicator
@ PM_SliderControlThickness
@ PM_MenuDesktopFrameWidth
@ PM_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 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...
const QStyleOptionButton * btn
[3]
static const QColor darkTabBarTabBackgroundActiveHovered(32, 32, 32)
static const QColor tabBarTabLineActiveHovered()
static const QColor darkTabBarTabLineActive(90, 90, 90)
static const QColor darkTabBarTabBackground(38, 38, 38)
static const QColor tabBarTabBackgroundActiveHovered()
static const QColor lightTabBarTabBackgroundSelected(246, 246, 246)
static const QColor lightTabBarTabLineActiveHovered(150, 150, 150)
static const QColor lightTabBarTabBackground(227, 227, 227)
static const QColor lightTabBarTabLineSelected(189, 189, 189)
static const QColor tabBarTabBackgroundSelected()
static const QColor lightTabBarTabLineActive(160, 160, 160)
static const QColor darkTabBarTabLineActiveHovered(90, 90, 90)
QBrush brushForToolButton(bool isOnKeyWindow)
static const QColor darkTabBarTabLineSelected(90, 90, 90)
static const QColor darkTabBarTabBackgroundActive(38, 38, 38)
static const QColor lightTabBarTabBackgroundActiveSelected(211, 211, 211)
static const QColor lightTabBarTabBackgroundActive(190, 190, 190)
static const QColor lightTabBarTabLine(210, 210, 210)
static const QColor tabBarTabLineActive()
static const QColor tabBarTabBackgroundActiveSelected()
QRect rotateTabPainter(QPainter *p, QStyleOptionTab::Shape shape, QRect tabRect)
static const QColor tabBarTabBackgroundActive()
static const int closeButtonSize
static const QColor darkTabBarTabLine(90, 90, 90)
static const QColor tabBarTabLine()
static const QColor darkTabBarTabBackgroundSelected(52, 52, 52)
static const QColor tabBarTabBackground()
static const QColor tabBarTabLineSelected()
void drawTabShape(QPainter *p, const QStyleOptionTab *tabOpt, bool isUnified, int tabOverlap)
void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb)
static const QColor darkTabBarTabBackgroundActiveSelected(52, 52, 52)
static const QColor lightTabBarTabBackgroundActiveHovered(178, 178, 178)
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
@ ToolButtonTextUnderIcon
@ ToolButtonTextBesideIcon
#define Q_STATIC_ASSERT(Condition)
#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 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 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 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 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
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei const GLint * box
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
struct CGContext * CGContextRef
static constexpr QSize frameSize(const T &frame)
#define QT_NAMESPACE_ALIAS_OBJC_CLASS(name)
#define LargeSmallMini(option, large, small, mini)
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
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
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