9#include <QtCore/qscopedvaluerollback.h>
11#include <QtGui/private/qguiapplication_p.h>
12#include <QtGui/qpa/qplatformtheme.h>
14#include <UIKit/UIKit.h>
16@implementation QUIWindow
18- (instancetype)initWithFrame:(CGRect)frame
20 if ((self = [super initWithFrame:frame]))
21 self->_sendingEvent = NO;
26- (instancetype)initWithWindowScene:(UIWindowScene *)windowScene
28 if ((self = [super initWithWindowScene:windowScene]))
29 self->_sendingEvent = NO;
31 QIOSTheme::applyTheme(self);
35- (
void)sendEvent:(UIEvent *)event
37 QScopedValueRollback<BOOL> sendingEvent(self->_sendingEvent, YES);
38 [super sendEvent:event];
41#if !defined(Q_OS_VISIONOS)
42- (
void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
44 [super traitCollectionDidChange:previousTraitCollection];
49 Qt::ColorScheme colorScheme = self.traitCollection.userInterfaceStyle
50 == UIUserInterfaceStyleDark
51 ? Qt::ColorScheme::Dark
52 : Qt::ColorScheme::Light;
54 if (self.screen == UIScreen.mainScreen) {
57 if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle
58 || QGuiApplicationPrivate::platformTheme()->colorScheme() != colorScheme) {
59 QIOSTheme::initializeSystemPalette();
60 QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();