Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwasmcssstyle.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
8
9#include <QtCore/qstring.h>
10#include <QtCore/qfile.h>
11
13
14namespace {
15const char *Style = R"css(
16.qt-screen {
17 --border-width: 4px;
18 --resize-outline-width: 8px;
19 --resize-outline-half-width: var(--resize-outline-width) / 2;
20
21 position: relative;
22 border: none;
23 caret-color: transparent;
24 cursor: default;
25 width: 100%;
26 height: 100%;
27 overflow: hidden;
28}
29
30.qt-screen div {
31 touch-action: none;
32}
33
34.qt-decorated-window {
35 position: absolute;
36 background-color: lightgray;
37}
38
39.qt-window {
40 overflow: clip;
41 position: relative;
42}
43
44.qt-window-canvas {
45 position: absolute;
46 left: 0;
47 top: 0;
48}
49
50.qt-decorated-window.transparent-for-input {
51 pointer-events: none;
52}
53
54.qt-decorated-window.has-shadow {
55 box-shadow: rgb(0 0 0 / 20%) 0px 10px 16px 0px, rgb(0 0 0 / 19%) 0px 6px 20px 0px;
56}
57
58.qt-decorated-window.has-border {
59 border: var(--border-width) solid lightgray;
60 caret-color: transparent;
61}
62
63.qt-decorated-window.frameless {
64 background-color: transparent;
65}
66
67.resize-outline {
68 position: absolute;
69 display: none;
70}
71
72.qt-decorated-window.no-resize > .resize-outline { display: none; }
73
74.qt-decorated-window.has-border:not(.maximized):not(.no-resize) > .resize-outline {
75 display: block;
76}
77
78.resize-outline.nw {
79 left: calc(-1 * var(--resize-outline-half-width) - var(--border-width));
80 top: calc(-1 * var(--resize-outline-half-width) - var(--border-width));
81 width: var(--resize-outline-width);
82 height: var(--resize-outline-width);
83 cursor: nwse-resize;
84}
85
86.resize-outline.n {
87 left: var(--resize-outline-half-width);
88 top: calc(-1 * var(--resize-outline-half-width) - var(--border-width));
89 height: var(--resize-outline-width);
90 width: calc(100% + 2 * var(--border-width) - var(--resize-outline-width));
91 cursor: ns-resize;
92}
93
94.resize-outline.ne {
95 left: calc(100% + var(--border-width) - var(--resize-outline-half-width));
96 top: calc(-1 * var(--resize-outline-half-width) - var(--border-width));
97 width: var(--resize-outline-width);
98 height: var(--resize-outline-width);
99 cursor: nesw-resize;
100}
101
102.resize-outline.w {
103 left: calc(-1 * var(--resize-outline-half-width) - var(--border-width));
104 top: 0;
105 height: calc(100% + 2 * var(--border-width) - var(--resize-outline-width));
106 width: var(--resize-outline-width);
107 cursor: ew-resize;
108}
109
110.resize-outline.e {
111 left: calc(100% + var(--border-width) - var(--resize-outline-half-width));
112 top: 0;
113 height: calc(100% + 2 * var(--border-width) - var(--resize-outline-width));
114 width: var(--resize-outline-width);
115 cursor: ew-resize;
116}
117
118.resize-outline.sw {
119 left: calc(-1 * var(--resize-outline-half-width) - var(--border-width));
120 top: calc(100% + var(--border-width) - var(--resize-outline-half-width));
121 width: var(--resize-outline-width);
122 height: var(--resize-outline-width);
123 cursor: nesw-resize;
124}
125
126.resize-outline.s {
127 left: var(--resize-outline-half-width);
128 top: calc(100% + var(--border-width) - var(--resize-outline-half-width));
129 height: var(--resize-outline-width);
130 width: calc(100% + 2 * var(--border-width) - var(--resize-outline-width));
131 cursor: ns-resize;
132}
133
134.resize-outline.se {
135 left: calc(100% + var(--border-width) - var(--resize-outline-half-width));
136 top: calc(100% + var(--border-width) - var(--resize-outline-half-width));
137 width: var(--resize-outline-width);
138 height: var(--resize-outline-width);
139 cursor: nwse-resize;
140}
141
142.title-bar {
143 display: none;
144 align-items: center;
145 overflow: hidden;
146 height: 18px;
147 padding-bottom: 4px;
148}
149
150.qt-decorated-window.has-border > .title-bar {
151 display: flex;
152}
153
154.title-bar .window-name {
155 display: none;
156 font-family: 'Lucida Grande';
157 white-space: nowrap;
158 user-select: none;
159 overflow: hidden;
160}
161
162
163.qt-decorated-window.has-title .title-bar .window-name {
164 display: block;
165}
166
167.title-bar .spacer {
168 flex-grow: 1
169}
170
171.qt-decorated-window.inactive .title-bar {
172 opacity: 0.35;
173}
174
175.title-bar div {
176 pointer-events: none;
177}
178
179.qt-window-a11y-container {
180 position: absolute;
181 left: 0;
182 top: 0;
183 z-index: -1;
184}
185
186.title-bar .image-button {
187 width: 18px;
188 height: 18px;
189 display: flex;
190 justify-content: center;
191 user-select: none;
192 align-items: center;
193}
194
195.title-bar .image-button img {
196 width: 10px;
197 height: 10px;
198 user-select: none;
199 pointer-events: none;
200 -webkit-user-drag: none;
201 background-size: 10px 10px;
202}
203
204.title-bar .action-button {
205 pointer-events: all;
206}
207
208.qt-decorated-window.blocked div {
209 pointer-events: none;
210}
211
212.title-bar .action-button img {
213 transition: filter 0.08s ease-out;
214}
215
216.title-bar .action-button:hover img {
217 filter: invert(0.45);
218}
219
220.title-bar .action-button:active img {
221 filter: invert(0.6);
222}
223
224/* This will clip the content within 50% frame in 1x1 pixel area, preventing it
225 from being rendered on the page, but it should still be read by modern
226 screen readers */
227.hidden-visually-read-by-screen-reader {
228 visibility: visible;
229 clip: rect(1px, 1px, 1px, 1px);
230 clip-path: inset(50%);
231 height: 100%;
232 width: 100%;
233 margin: -1px;
234 overflow: hidden;
235 padding: 0;
236 position: absolute;
237}
238
239.hidden-drag-image {
240 visibility: visible;
241 display: block;
242 opacity: 1.0;
243 position: absolute;
244 z-index: -1;
245}
246
247)css";
248
249} // namespace
250
252{
253 auto document = parent["ownerDocument"];
254 auto screenStyle = document.call<emscripten::val>("createElement", emscripten::val("style"));
255
256 screenStyle.set("textContent", std::string(Style));
257 return screenStyle;
258}
259
260QT_END_NAMESPACE
Combined button and popup list for selecting options.
emscripten::val createStyleElement(emscripten::val parent)