summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/cocoa/qcocoa_plugin_pch.h16
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style.cpp28
3 files changed, 28 insertions, 18 deletions
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt
index 07cffb24726..72d55c0791a 100644
--- a/src/plugins/platforms/cocoa/CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/CMakeLists.txt
@@ -57,6 +57,8 @@ qt_internal_add_plugin(QCocoaIntegrationPlugin
qcocoamessagedialog.h qcocoamessagedialog.mm
DEFINES
QT_NO_FOREACH
+ PRECOMPILED_HEADER
+ $<$<COMPILE_LANGUAGE:OBJCXX>:qcocoa_plugin_pch.h>
LIBRARIES
${FWFoundation}
${FWAppKit}
diff --git a/src/plugins/platforms/cocoa/qcocoa_plugin_pch.h b/src/plugins/platforms/cocoa/qcocoa_plugin_pch.h
new file mode 100644
index 00000000000..05d4bae299f
--- /dev/null
+++ b/src/plugins/platforms/cocoa/qcocoa_plugin_pch.h
@@ -0,0 +1,16 @@
+// Copyright (C) 2025 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtCore/QtCore>
+#include <QtGui/QtGui>
+
+#include <Carbon/Carbon.h>
+#include <CoreGraphics/CoreGraphics.h>
+#include <CoreVideo/CoreVideo.h>
+#include <IOKit/graphics/IOGraphicsLib.h>
+#include <IOSurface/IOSurface.h>
+#include <QuartzCore/QuartzCore.h>
+
+#import <AppKit/AppKit.h>
+#import <MetalKit/MetalKit.h>
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp
index b37140cba5e..bf4b3c6a9bc 100644
--- a/src/plugins/styles/modernwindows/qwindows11style.cpp
+++ b/src/plugins/styles/modernwindows/qwindows11style.cpp
@@ -236,7 +236,7 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
}
#endif // QT_CONFIG(toolbutton)
-static qreal radioButtonInnerRadius(int state)
+static qreal radioButtonInnerRadius(QStyle::State state)
{
qreal radius = 7.0;
if (state & QStyle::State_Sunken)
@@ -353,7 +353,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
if (widget && widget->testAttribute(Qt::WA_UnderMouse) && widget->isActiveWindow())
flags |= State_MouseOver;
- painter->save();
+ QPainterStateGuard psg(painter);
painter->setRenderHint(QPainter::Antialiasing);
if (d->transitionsEnabled() && option->styleObject) {
if (control == CC_Slider) {
@@ -536,10 +536,9 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
v = nextInterval;
}
if (!lines.isEmpty()) {
- painter->save();
+ QPainterStateGuard psg(painter);
painter->translate(slrect.topLeft());
painter->drawLines(lines.constData(), lines.size());
- painter->restore();
}
}
if (sub & SC_SliderHandle) {
@@ -765,7 +764,6 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
default:
QWindowsVistaStyle::drawComplexControl(control, option, painter, widget);
}
- painter->restore();
}
void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
@@ -773,8 +771,8 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
const QWidget *widget) const {
QWindows11StylePrivate *d = const_cast<QWindows11StylePrivate*>(d_func());
- int state = option->state;
- painter->save();
+ const State state = option->state;
+ QPainterStateGuard psg(painter);
painter->setRenderHint(QPainter::Antialiasing);
if (d->transitionsEnabled() && option->styleObject && (element == PE_IndicatorCheckBox || element == PE_IndicatorRadioButton)) {
QObject *styleObject = option->styleObject; // Can be widget or qquickitem
@@ -1095,17 +1093,15 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->setBrush(view->alternatingRowColors() ? vopt->palette.highlight() : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]);
painter->setPen(Qt::NoPen);
if (isFirst) {
- painter->save();
+ QPainterStateGuard psg(painter);
painter->setClipRect(rect);
painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, -secondLevelRoundingRadius, 2)),
secondLevelRoundingRadius, secondLevelRoundingRadius);
- painter->restore();
} else if (isLast) {
- painter->save();
+ QPainterStateGuard psg(painter);
painter->setClipRect(rect);
painter->drawRoundedRect(rect.marginsRemoved(QMargins(-secondLevelRoundingRadius, 2, 2, 2)),
secondLevelRoundingRadius, secondLevelRoundingRadius);
- painter->restore();
} else {
painter->drawRect(vopt->rect.marginsRemoved(QMargins(0, 2, 0, 2)));
}
@@ -1185,7 +1181,6 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
default:
QWindowsVistaStyle::drawPrimitive(element, option, painter, widget);
}
- painter->restore();
}
/*!
@@ -1197,7 +1192,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
Q_D(const QWindows11Style);
State flags = option->state;
- painter->save();
+ QPainterStateGuard psg(painter);
painter->setRenderHint(QPainter::Antialiasing);
switch (element) {
case QStyle::CE_ComboBoxLabel:
@@ -1794,17 +1789,15 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, 2, 2)),
secondLevelRoundingRadius, secondLevelRoundingRadius);
} else if (isFirst) {
- painter->save();
+ QPainterStateGuard psg(painter);
painter->setClipRect(rect);
painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, -secondLevelRoundingRadius, 2)),
secondLevelRoundingRadius, secondLevelRoundingRadius);
- painter->restore();
} else if (isLast) {
- painter->save();
+ QPainterStateGuard psg(painter);
painter->setClipRect(rect);
painter->drawRoundedRect(rect.marginsRemoved(QMargins(-secondLevelRoundingRadius, 2, 2, 2)),
secondLevelRoundingRadius, secondLevelRoundingRadius);
- painter->restore();
} else {
painter->drawRect(rect.marginsRemoved(QMargins(0, 2, 0, 2)));
}
@@ -1864,7 +1857,6 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
default:
QWindowsVistaStyle::drawControl(element, option, painter, widget);
}
- painter->restore();
}
int QWindows11Style::styleHint(StyleHint hint, const QStyleOption *opt,