Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
quiwindow.mm
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"quiwindow.h"
6
7
#
include
"qiostheme.h"
8
9
#
include
<
QtCore
/
qscopedvaluerollback
.
h
>
10
11
#
include
<
QtGui
/
private
/
qguiapplication_p
.
h
>
12
#
include
<
QtGui
/
qpa
/
qplatformtheme
.
h
>
13
14
#
include
<
UIKit
/
UIKit
.
h
>
15
16
@implementation QUIWindow
17
18
- (instancetype)initWithFrame:(CGRect)frame
19
{
20
if
((self = [super initWithFrame:frame]))
21
self->_sendingEvent = NO;
22
23
return
self;
24
}
25
26
- (instancetype)initWithWindowScene:(UIWindowScene *)windowScene
27
{
28
if
((self = [super initWithWindowScene:windowScene]))
29
self->_sendingEvent = NO;
30
31
QIOSTheme::applyTheme(self);
32
return
self;
33
}
34
35
- (
void
)sendEvent:(UIEvent *)event
36
{
37
QScopedValueRollback<BOOL> sendingEvent(self->_sendingEvent, YES);
38
[super sendEvent:event];
39
}
40
41
#
if
!
defined
(
Q_OS_VISIONOS
)
42
- (
void
)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
43
{
44
[super traitCollectionDidChange:previousTraitCollection];
45
46
if
(!qGuiApp)
47
return
;
48
49
Qt::ColorScheme colorScheme = self.traitCollection.userInterfaceStyle
50
== UIUserInterfaceStyleDark
51
? Qt::ColorScheme::Dark
52
: Qt::ColorScheme::Light;
53
54
if
(self.screen == UIScreen.mainScreen) {
55
// Check if the current userInterfaceStyle reports a different appearance than
56
// the platformTheme's appearance. We might have set that one based on the UIScreen
57
// Check for changes in the "Increase contrast" setting too.
58
if
(previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle
59
|| previousTraitCollection.accessibilityContrast != self.traitCollection.accessibilityContrast
60
|| QGuiApplicationPrivate::platformTheme()->colorScheme() != colorScheme) {
61
QIOSTheme::initializeSystemPalette();
62
QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
63
}
64
}
65
}
66
#
endif
67
68
@end
qtbase
src
plugins
platforms
ios
quiwindow.mm
Generated on
for Qt by
1.18.0