@@ -31,145 +31,23 @@ Window {
3131 property int screenOrientation: Screen .primaryOrientation
3232 property int screenOrientationFull: Screen .orientation
3333
34- property int screenPaddingStatusbar: 0
35- property int screenPaddingNavbar: 0
36-
37- property int screenPaddingTop: 0
38- property int screenPaddingLeft: 0
39- property int screenPaddingRight: 0
40- property int screenPaddingBottom: 0
41-
42- Connections {
43- target: Screen
44- function onOrientationChanged () { mobileUI .handleSafeAreas_withDelays () }
45- }
46- Connections {
47- target: Theme
48- function onCurrentThemeChanged () { mobileUI .handleSafeAreas_withDelays () }
49- }
50-
51- Timer {
52- id: rotateTimer1
53- interval: 50
54- running: false
55- repeat: false
56- onTriggered: { mobileUI .handleSafeAreas () }
57- }
58- Timer {
59- id: rotateTimer2
60- interval: 256
61- running: false
62- repeat: false
63- onTriggered: { mobileUI .handleSafeAreas () }
64- }
65- Timer {
66- id: rotateTimer3
67- interval: 512
68- running: false
69- repeat: false
70- onTriggered: { mobileUI .handleSafeAreas () }
34+ property int screenPaddingStatusbar: MobileUI .statusbarHeight
35+ property int screenPaddingNavbar: MobileUI .navbarHeight
36+
37+ property int screenPaddingTop: MobileUI .safeAreaTop
38+ property int screenPaddingLeft: MobileUI .safeAreaLeft
39+ property int screenPaddingRight: MobileUI .safeAreaRight
40+ property int screenPaddingBottom: MobileUI .safeAreaBottom
41+
42+ Binding {
43+ target: MobileUI
44+ property: " statusbarTheme"
45+ value: { return (appContent .state === " ScreenBarcodeReader" ) ? MobileUI .Dark : Theme .themeStatusbar }
7146 }
72- Timer {
73- id: rotateTimer4
74- interval: 1000
75- running: false
76- repeat: false
77- onTriggered: { mobileUI .handleSafeAreas () }
78- }
79-
80- MobileUI {
81- id: mobileUI
82-
83- statusbarColor: " transparent"
84- statusbarTheme: (appContent .state === " ScreenBarcodeReader" ) ? MobileUI .Dark : Theme .themeStatusbar
85-
86- navbarColor: " transparent"
87- navbarTheme: (appContent .state === " ScreenBarcodeReader" ) ? MobileUI .Dark : Theme .themeStatusbar
88-
89- Component .onCompleted : {
90- mobileUI .handleSafeAreas_withDelays ()
91- }
92-
93- function handleSafeAreas_withDelays () {
94- handleSafeAreas ()
95- rotateTimer1 .start ()
96- rotateTimer2 .start ()
97- rotateTimer3 .start ()
98- rotateTimer4 .start ()
99- }
100-
101- function handleSafeAreas () {
102- // safe areas handling is a work in progress /!\
103- // safe areas are only taken into account when using maximized geometry / full screen mode
104-
105- mobileUI .refreshUI () // hack
106-
107- mobileUI .statusbarTheme = Theme .themeStatusbar // hack
108-
109- if (appWindow .visibility === Window .FullScreen ||
110- appWindow .flags & Qt .MaximizeUsingFullscreenGeometryHint ) {
111-
112- screenPaddingStatusbar = mobileUI .statusbarHeight
113- screenPaddingNavbar = mobileUI .navbarHeight
114-
115- screenPaddingTop = mobileUI .safeAreaTop
116- screenPaddingLeft = mobileUI .safeAreaLeft
117- screenPaddingRight = mobileUI .safeAreaRight
118- screenPaddingBottom = mobileUI .safeAreaBottom
119-
120- // hacks
121- if (Qt .platform .os === " android" ) {
122- if (appWindow .visibility === Window .FullScreen ) {
123- screenPaddingStatusbar = 0
124- screenPaddingNavbar = 0
125- }
126- if (appWindow .flags & Qt .MaximizeUsingFullscreenGeometryHint ) {
127- if (mobileUI .isPhone ) {
128- if (Screen .orientation === Qt .LandscapeOrientation ) {
129- screenPaddingLeft = screenPaddingStatusbar
130- screenPaddingRight = screenPaddingNavbar
131- screenPaddingNavbar = 0
132- } else if (Screen .orientation === Qt .InvertedLandscapeOrientation ) {
133- screenPaddingLeft = screenPaddingNavbar
134- screenPaddingRight = screenPaddingStatusbar
135- screenPaddingNavbar = 0
136- }
137- }
138- }
139- }
140- // hacks
141- if (Qt .platform .os === " ios" ) {
142- if (appWindow .visibility === Window .FullScreen ) {
143- screenPaddingStatusbar = 0
144- }
145- }
146- } else {
147- screenPaddingStatusbar = 0
148- screenPaddingNavbar = 0
149- screenPaddingTop = 0
150- screenPaddingLeft = 0
151- screenPaddingRight = 0
152- screenPaddingBottom = 0
153- }
154- /*
155- console.log("> handleSafeAreas()")
156- console.log("- window mode: " + appWindow.visibility)
157- console.log("- window flags: " + appWindow.flags)
158- console.log("- screen dpi: " + Screen.devicePixelRatio)
159- console.log("- screen width: " + Screen.width)
160- console.log("- screen width avail: " + Screen.desktopAvailableWidth)
161- console.log("- screen height: " + Screen.height)
162- console.log("- screen height avail: " + Screen.desktopAvailableHeight)
163- console.log("- screen orientation (full): " + Screen.orientation)
164- console.log("- screen orientation (primary): " + Screen.primaryOrientation)
165- console.log("- screenSizeStatusbar: " + screenPaddingStatusbar)
166- console.log("- screenSizeNavbar: " + screenPaddingNavbar)
167- console.log("- screenPaddingTop: " + screenPaddingTop)
168- console.log("- screenPaddingLeft: " + screenPaddingLeft)
169- console.log("- screenPaddingRight: " + screenPaddingRight)
170- console.log("- screenPaddingBottom: " + screenPaddingBottom)
171- */
172- }
47+ Binding {
48+ target: MobileUI
49+ property: " navbarTheme"
50+ value: { return (appContent .state === " ScreenBarcodeReader" ) ? MobileUI .Dark : Theme .themeStatusbar }
17351 }
17452
17553 MobileHeader {
0 commit comments