Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickscreen.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | QQuickScreenInfo::QQuickScreenInfo(QObject *parent, QScreen *wrappedScreen) | - | ||||||||||||
7 | : QObject(parent) | - | ||||||||||||
8 | , m_screen(wrappedScreen) | - | ||||||||||||
9 | { | - | ||||||||||||
10 | } executed 52 times by 5 tests: end of block Executed by:
| 52 | ||||||||||||
11 | - | |||||||||||||
12 | QString QQuickScreenInfo::name() const | - | ||||||||||||
13 | { | - | ||||||||||||
14 | if (!m_screen
| 0-2 | ||||||||||||
15 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
16 | return executed 2 times by 1 test: m_screen->name();return m_screen->name(); Executed by:
executed 2 times by 1 test: return m_screen->name(); Executed by:
| 2 | ||||||||||||
17 | } | - | ||||||||||||
18 | - | |||||||||||||
19 | QString QQuickScreenInfo::manufacturer() const | - | ||||||||||||
20 | { | - | ||||||||||||
21 | if (!m_screen
| 0-2 | ||||||||||||
22 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
23 | return executed 2 times by 1 test: m_screen->manufacturer();return m_screen->manufacturer(); Executed by:
executed 2 times by 1 test: return m_screen->manufacturer(); Executed by:
| 2 | ||||||||||||
24 | } | - | ||||||||||||
25 | - | |||||||||||||
26 | QString QQuickScreenInfo::model() const | - | ||||||||||||
27 | { | - | ||||||||||||
28 | if (!m_screen
| 0-2 | ||||||||||||
29 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
30 | return executed 2 times by 1 test: m_screen->model();return m_screen->model(); Executed by:
executed 2 times by 1 test: return m_screen->model(); Executed by:
| 2 | ||||||||||||
31 | } | - | ||||||||||||
32 | - | |||||||||||||
33 | QString QQuickScreenInfo::serialNumber() const | - | ||||||||||||
34 | { | - | ||||||||||||
35 | if (!m_screen
| 0-2 | ||||||||||||
36 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
37 | return executed 2 times by 1 test: m_screen->serialNumber();return m_screen->serialNumber(); Executed by:
executed 2 times by 1 test: return m_screen->serialNumber(); Executed by:
| 2 | ||||||||||||
38 | } | - | ||||||||||||
39 | - | |||||||||||||
40 | int QQuickScreenInfo::width() const | - | ||||||||||||
41 | { | - | ||||||||||||
42 | if (!m_screen
| 0-8 | ||||||||||||
43 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
44 | return executed 8 times by 1 test: m_screen->size().width();return m_screen->size().width(); Executed by:
executed 8 times by 1 test: return m_screen->size().width(); Executed by:
| 8 | ||||||||||||
45 | } | - | ||||||||||||
46 | - | |||||||||||||
47 | int QQuickScreenInfo::height() const | - | ||||||||||||
48 | { | - | ||||||||||||
49 | if (!m_screen
| 0-8 | ||||||||||||
50 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
51 | return executed 8 times by 1 test: m_screen->size().height();return m_screen->size().height(); Executed by:
executed 8 times by 1 test: return m_screen->size().height(); Executed by:
| 8 | ||||||||||||
52 | } | - | ||||||||||||
53 | - | |||||||||||||
54 | int QQuickScreenInfo::desktopAvailableWidth() const | - | ||||||||||||
55 | { | - | ||||||||||||
56 | if (!m_screen
| 0-2 | ||||||||||||
57 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
58 | return executed 2 times by 1 test: m_screen->availableVirtualSize().width();return m_screen->availableVirtualSize().width(); Executed by:
executed 2 times by 1 test: return m_screen->availableVirtualSize().width(); Executed by:
| 2 | ||||||||||||
59 | } | - | ||||||||||||
60 | - | |||||||||||||
61 | int QQuickScreenInfo::desktopAvailableHeight() const | - | ||||||||||||
62 | { | - | ||||||||||||
63 | if (!m_screen
| 0-2 | ||||||||||||
64 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
65 | return executed 2 times by 1 test: m_screen->availableVirtualSize().height();return m_screen->availableVirtualSize().height(); Executed by:
executed 2 times by 1 test: return m_screen->availableVirtualSize().height(); Executed by:
| 2 | ||||||||||||
66 | } | - | ||||||||||||
67 | - | |||||||||||||
68 | qreal QQuickScreenInfo::logicalPixelDensity() const | - | ||||||||||||
69 | { | - | ||||||||||||
70 | if (!m_screen
| 0 | ||||||||||||
71 | return never executed: 0.0;return 0.0; never executed: return 0.0; | 0 | ||||||||||||
72 | return never executed: m_screen->logicalDotsPerInch() / 25.4;return m_screen->logicalDotsPerInch() / 25.4; never executed: return m_screen->logicalDotsPerInch() / 25.4; | 0 | ||||||||||||
73 | } | - | ||||||||||||
74 | - | |||||||||||||
75 | qreal QQuickScreenInfo::pixelDensity() const | - | ||||||||||||
76 | { | - | ||||||||||||
77 | if (!m_screen
| 0-120 | ||||||||||||
78 | return never executed: 0.0;return 0.0; never executed: return 0.0; | 0 | ||||||||||||
79 | return executed 120 times by 1 test: m_screen->physicalDotsPerInch() / 25.4;return m_screen->physicalDotsPerInch() / 25.4; Executed by:
executed 120 times by 1 test: return m_screen->physicalDotsPerInch() / 25.4; Executed by:
| 120 | ||||||||||||
80 | } | - | ||||||||||||
81 | - | |||||||||||||
82 | qreal QQuickScreenInfo::devicePixelRatio() const | - | ||||||||||||
83 | { | - | ||||||||||||
84 | if (!m_screen
| 0-16 | ||||||||||||
85 | return never executed: 1.0;return 1.0; never executed: return 1.0; | 0 | ||||||||||||
86 | return executed 16 times by 2 tests: m_screen->devicePixelRatio();return m_screen->devicePixelRatio(); Executed by:
executed 16 times by 2 tests: return m_screen->devicePixelRatio(); Executed by:
| 16 | ||||||||||||
87 | } | - | ||||||||||||
88 | - | |||||||||||||
89 | Qt::ScreenOrientation QQuickScreenInfo::primaryOrientation() const | - | ||||||||||||
90 | { | - | ||||||||||||
91 | if (!m_screen
| 0-6 | ||||||||||||
92 | return never executed: Qt::PrimaryOrientation;return Qt::PrimaryOrientation; never executed: return Qt::PrimaryOrientation; | 0 | ||||||||||||
93 | return executed 6 times by 1 test: m_screen->primaryOrientation();return m_screen->primaryOrientation(); Executed by:
executed 6 times by 1 test: return m_screen->primaryOrientation(); Executed by:
| 6 | ||||||||||||
94 | } | - | ||||||||||||
95 | - | |||||||||||||
96 | Qt::ScreenOrientation QQuickScreenInfo::orientation() const | - | ||||||||||||
97 | { | - | ||||||||||||
98 | if (!m_screen
| 0-6 | ||||||||||||
99 | return never executed: Qt::PrimaryOrientation;return Qt::PrimaryOrientation; never executed: return Qt::PrimaryOrientation; | 0 | ||||||||||||
100 | return executed 6 times by 1 test: m_screen->orientation();return m_screen->orientation(); Executed by:
executed 6 times by 1 test: return m_screen->orientation(); Executed by:
| 6 | ||||||||||||
101 | } | - | ||||||||||||
102 | - | |||||||||||||
103 | int QQuickScreenInfo::virtualX() const | - | ||||||||||||
104 | { | - | ||||||||||||
105 | if (!m_screen
| 0-8 | ||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
107 | return executed 8 times by 1 test: m_screen->geometry().topLeft().x();return m_screen->geometry().topLeft().x(); Executed by:
executed 8 times by 1 test: return m_screen->geometry().topLeft().x(); Executed by:
| 8 | ||||||||||||
108 | } | - | ||||||||||||
109 | - | |||||||||||||
110 | int QQuickScreenInfo::virtualY() const | - | ||||||||||||
111 | { | - | ||||||||||||
112 | if (!m_screen
| 0-8 | ||||||||||||
113 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
114 | return executed 8 times by 1 test: m_screen->geometry().topLeft().y();return m_screen->geometry().topLeft().y(); Executed by:
executed 8 times by 1 test: return m_screen->geometry().topLeft().y(); Executed by:
| 8 | ||||||||||||
115 | } | - | ||||||||||||
116 | - | |||||||||||||
117 | void QQuickScreenInfo::setWrappedScreen(QScreen *screen) | - | ||||||||||||
118 | { | - | ||||||||||||
119 | if (screen == m_screen
| 0-90 | ||||||||||||
120 | return; never executed: return; | 0 | ||||||||||||
121 | - | |||||||||||||
122 | QScreen *oldScreen = m_screen; | - | ||||||||||||
123 | m_screen = screen; | - | ||||||||||||
124 | - | |||||||||||||
125 | if (oldScreen
| 38-52 | ||||||||||||
126 | oldScreen->disconnect(this); executed 38 times by 3 tests: oldScreen->disconnect(this); Executed by:
| 38 | ||||||||||||
127 | - | |||||||||||||
128 | if (!screen
| 38-52 | ||||||||||||
129 | return; executed 38 times by 3 tests: return; Executed by:
| 38 | ||||||||||||
130 | - | |||||||||||||
131 | if (!oldScreen
| 0-52 | ||||||||||||
132 | virtualXChanged(); | - | ||||||||||||
133 | virtualYChanged(); | - | ||||||||||||
134 | } executed 52 times by 5 tests: end of block Executed by:
| 52 | ||||||||||||
135 | if (!oldScreen
| 0-52 | ||||||||||||
136 | widthChanged(); | - | ||||||||||||
137 | heightChanged(); | - | ||||||||||||
138 | } executed 52 times by 5 tests: end of block Executed by:
| 52 | ||||||||||||
139 | if (!oldScreen
| 0-52 | ||||||||||||
140 | nameChanged(); executed 52 times by 5 tests: nameChanged(); Executed by:
| 52 | ||||||||||||
141 | if (!oldScreen
| 0-52 | ||||||||||||
142 | manufacturerChanged(); executed 52 times by 5 tests: manufacturerChanged(); Executed by:
| 52 | ||||||||||||
143 | if (!oldScreen
| 0-52 | ||||||||||||
144 | modelChanged(); executed 52 times by 5 tests: modelChanged(); Executed by:
| 52 | ||||||||||||
145 | if (!oldScreen
| 0-52 | ||||||||||||
146 | serialNumberChanged(); executed 52 times by 5 tests: serialNumberChanged(); Executed by:
| 52 | ||||||||||||
147 | if (!oldScreen
| 0-52 | ||||||||||||
148 | orientationChanged(); executed 52 times by 5 tests: orientationChanged(); Executed by:
| 52 | ||||||||||||
149 | if (!oldScreen
| 0-52 | ||||||||||||
150 | primaryOrientationChanged(); executed 52 times by 5 tests: primaryOrientationChanged(); Executed by:
| 52 | ||||||||||||
151 | if (!oldScreen
| 0-52 | ||||||||||||
152 | desktopGeometryChanged(); executed 52 times by 5 tests: desktopGeometryChanged(); Executed by:
| 52 | ||||||||||||
153 | if (!oldScreen
| 0-52 | ||||||||||||
154 | logicalPixelDensityChanged(); executed 52 times by 5 tests: logicalPixelDensityChanged(); Executed by:
| 52 | ||||||||||||
155 | if (!oldScreen
| 0-52 | ||||||||||||
156 | pixelDensityChanged(); executed 52 times by 5 tests: pixelDensityChanged(); Executed by:
| 52 | ||||||||||||
157 | if (!oldScreen
| 0-52 | ||||||||||||
158 | devicePixelRatioChanged(); executed 52 times by 5 tests: devicePixelRatioChanged(); Executed by:
| 52 | ||||||||||||
159 | - | |||||||||||||
160 | connect(screen, qFlagLocation("2""geometryChanged(QRect)" "\0" __FILE__ ":" "399"), | - | ||||||||||||
161 | this, qFlagLocation("2""widthChanged()" "\0" __FILE__ ":" "400")); | - | ||||||||||||
162 | connect(screen, qFlagLocation("2""geometryChanged(QRect)" "\0" __FILE__ ":" "401"), | - | ||||||||||||
163 | this, qFlagLocation("2""heightChanged()" "\0" __FILE__ ":" "402")); | - | ||||||||||||
164 | connect(screen, qFlagLocation("2""geometryChanged(QRect)" "\0" __FILE__ ":" "403"), | - | ||||||||||||
165 | this, qFlagLocation("2""virtualXChanged()" "\0" __FILE__ ":" "404")); | - | ||||||||||||
166 | connect(screen, qFlagLocation("2""geometryChanged(QRect)" "\0" __FILE__ ":" "405"), | - | ||||||||||||
167 | this, qFlagLocation("2""virtualYChanged()" "\0" __FILE__ ":" "406")); | - | ||||||||||||
168 | connect(screen, qFlagLocation("2""orientationChanged(Qt::ScreenOrientation)" "\0" __FILE__ ":" "407"), | - | ||||||||||||
169 | this, qFlagLocation("2""orientationChanged()" "\0" __FILE__ ":" "408")); | - | ||||||||||||
170 | connect(screen, qFlagLocation("2""primaryOrientationChanged(Qt::ScreenOrientation)" "\0" __FILE__ ":" "409"), | - | ||||||||||||
171 | this, qFlagLocation("2""primaryOrientationChanged()" "\0" __FILE__ ":" "410")); | - | ||||||||||||
172 | connect(screen, qFlagLocation("2""virtualGeometryChanged(QRect)" "\0" __FILE__ ":" "411"), | - | ||||||||||||
173 | this, qFlagLocation("2""desktopGeometryChanged()" "\0" __FILE__ ":" "412")); | - | ||||||||||||
174 | connect(screen, qFlagLocation("2""logicalDotsPerInchChanged(qreal)" "\0" __FILE__ ":" "413"), | - | ||||||||||||
175 | this, qFlagLocation("2""logicalPixelDensityChanged()" "\0" __FILE__ ":" "414")); | - | ||||||||||||
176 | connect(screen, qFlagLocation("2""physicalDotsPerInchChanged(qreal)" "\0" __FILE__ ":" "415"), | - | ||||||||||||
177 | this, qFlagLocation("2""pixelDensityChanged()" "\0" __FILE__ ":" "416")); | - | ||||||||||||
178 | } executed 52 times by 5 tests: end of block Executed by:
| 52 | ||||||||||||
179 | - | |||||||||||||
180 | QScreen *QQuickScreenInfo::wrappedScreen() const | - | ||||||||||||
181 | { | - | ||||||||||||
182 | return never executed: m_screen;return m_screen; never executed: return m_screen; | 0 | ||||||||||||
183 | } | - | ||||||||||||
184 | - | |||||||||||||
185 | QQuickScreenAttached::QQuickScreenAttached(QObject* attachee) | - | ||||||||||||
186 | : QQuickScreenInfo(attachee) | - | ||||||||||||
187 | , m_window(nullptr) | - | ||||||||||||
188 | , m_updateMask(nullptr) | - | ||||||||||||
189 | , m_updateMaskSet(false) | - | ||||||||||||
190 | { | - | ||||||||||||
191 | m_attachee = qobject_cast<QQuickItem*>(attachee); | - | ||||||||||||
192 | - | |||||||||||||
193 | if (m_attachee
| 0-40 | ||||||||||||
194 | QQuickItemPrivate::get(m_attachee)->extra.value().screenAttached = this; | - | ||||||||||||
195 | - | |||||||||||||
196 | if (m_attachee->window()
| 10-30 | ||||||||||||
197 | windowChanged(m_attachee->window()); executed 30 times by 1 test: windowChanged(m_attachee->window()); Executed by:
| 30 | ||||||||||||
198 | } executed 40 times by 3 tests: else {end of block Executed by:
| 40 | ||||||||||||
199 | QQuickWindow *window = qobject_cast<QQuickWindow*>(attachee); | - | ||||||||||||
200 | if (window
| 0 | ||||||||||||
201 | windowChanged(window); never executed: windowChanged(window); | 0 | ||||||||||||
202 | } never executed: end of block | 0 | ||||||||||||
203 | - | |||||||||||||
204 | if (!m_screen
| 10-30 | ||||||||||||
205 | screenChanged(QGuiApplication::primaryScreen()); executed 10 times by 2 tests: screenChanged(QGuiApplication::primaryScreen()); Executed by:
| 10 | ||||||||||||
206 | } executed 40 times by 3 tests: end of block Executed by:
| 40 | ||||||||||||
207 | - | |||||||||||||
208 | Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const | - | ||||||||||||
209 | { | - | ||||||||||||
210 | return executed 6 times by 1 test: m_updateMask;return m_updateMask; Executed by:
executed 6 times by 1 test: return m_updateMask; Executed by:
| 6 | ||||||||||||
211 | } | - | ||||||||||||
212 | - | |||||||||||||
213 | void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask) | - | ||||||||||||
214 | { | - | ||||||||||||
215 | m_updateMaskSet = true; | - | ||||||||||||
216 | if (m_updateMask == mask
| 2-4 | ||||||||||||
217 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||
218 | - | |||||||||||||
219 | m_updateMask = mask; | - | ||||||||||||
220 | - | |||||||||||||
221 | if (m_screen
| 0-2 | ||||||||||||
222 | m_screen->setOrientationUpdateMask(m_updateMask); executed 2 times by 1 test: m_screen->setOrientationUpdateMask(m_updateMask); Executed by:
| 2 | ||||||||||||
223 | - | |||||||||||||
224 | orientationUpdateMaskChanged(); | - | ||||||||||||
225 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
226 | - | |||||||||||||
227 | int QQuickScreenAttached::angleBetween(int a, int b) | - | ||||||||||||
228 | { | - | ||||||||||||
229 | if (!m_screen
| 0 | ||||||||||||
230 | return never executed: Qt::PrimaryOrientation;return Qt::PrimaryOrientation; never executed: return Qt::PrimaryOrientation; | 0 | ||||||||||||
231 | return never executed: m_screen->angleBetween((Qt::ScreenOrientation)a,(Qt::ScreenOrientation)b);return m_screen->angleBetween((Qt::ScreenOrientation)a,(Qt::ScreenOrientation)b); never executed: return m_screen->angleBetween((Qt::ScreenOrientation)a,(Qt::ScreenOrientation)b); | 0 | ||||||||||||
232 | } | - | ||||||||||||
233 | - | |||||||||||||
234 | void QQuickScreenAttached::windowChanged(QQuickWindow* c) | - | ||||||||||||
235 | { | - | ||||||||||||
236 | if (m_window
| 38 | ||||||||||||
237 | disconnect(m_window, qFlagLocation("2""screenChanged(QScreen*)" "\0" __FILE__ ":" "476"), this, qFlagLocation("1""screenChanged(QScreen*)" "\0" __FILE__ ":" "476")); executed 38 times by 3 tests: disconnect(m_window, qFlagLocation("2""screenChanged(QScreen*)" "\0" __FILE__ ":" "476"), this, qFlagLocation("1""screenChanged(QScreen*)" "\0" __FILE__ ":" "476")); Executed by:
| 38 | ||||||||||||
238 | m_window = c; | - | ||||||||||||
239 | screenChanged(c ? c->screen() : nullptr); | - | ||||||||||||
240 | if (c
| 38 | ||||||||||||
241 | connect(c, qFlagLocation("2""screenChanged(QScreen*)" "\0" __FILE__ ":" "480"), this, qFlagLocation("1""screenChanged(QScreen*)" "\0" __FILE__ ":" "480")); executed 38 times by 3 tests: connect(c, qFlagLocation("2""screenChanged(QScreen*)" "\0" __FILE__ ":" "480"), this, qFlagLocation("1""screenChanged(QScreen*)" "\0" __FILE__ ":" "480")); Executed by:
| 38 | ||||||||||||
242 | } executed 76 times by 3 tests: end of block Executed by:
| 76 | ||||||||||||
243 | - | |||||||||||||
244 | void QQuickScreenAttached::screenChanged(QScreen *screen) | - | ||||||||||||
245 | { | - | ||||||||||||
246 | - | |||||||||||||
247 | if (screen != m_screen
| 8-78 | ||||||||||||
248 | setWrappedScreen(screen); | - | ||||||||||||
249 | if (!m_screen
| 38-40 | ||||||||||||
250 | return; executed 38 times by 3 tests: return; Executed by:
| 38 | ||||||||||||
251 | if (m_updateMaskSet
| 0-40 | ||||||||||||
252 | m_screen->setOrientationUpdateMask(m_updateMask); | - | ||||||||||||
253 | } never executed: else if (m_updateMask != m_screen->orientationUpdateMask()end of block
| 0-36 | ||||||||||||
254 | m_updateMask = m_screen->orientationUpdateMask(); | - | ||||||||||||
255 | orientationUpdateMaskChanged(); | - | ||||||||||||
256 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||
257 | } executed 40 times by 3 tests: end of block Executed by:
| 40 | ||||||||||||
258 | } executed 48 times by 3 tests: end of block Executed by:
| 48 | ||||||||||||
259 | - | |||||||||||||
260 | - | |||||||||||||
261 | - | |||||||||||||
Switch to Source code | Preprocessed file |