kernel/qplatformintegration.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qplatformintegration.h" -
43 -
44#include <qpa/qplatformfontdatabase.h> -
45#include <qpa/qplatformclipboard.h> -
46#include <qpa/qplatformaccessibility.h> -
47#include <qpa/qplatformtheme.h> -
48#include <QtGui/private/qguiapplication_p.h> -
49#include <QtGui/private/qpixmap_raster_p.h> -
50#include <qpa/qplatformscreen_p.h> -
51#include <private/qdnd_p.h> -
52 -
53QT_BEGIN_NAMESPACE -
54 -
55/*! -
56 Accessor for the platform integration's fontdatabase. -
57 -
58 Default implementation returns a default QPlatformFontDatabase. -
59 -
60 \sa QPlatformFontDatabase -
61*/ -
62QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const -
63{ -
64 static QPlatformFontDatabase *db = 0; -
65 if (!db) {
never evaluated: !db
0
66 db = new QPlatformFontDatabase;
never executed (the execution status of this line is deduced): db = new QPlatformFontDatabase;
-
67 }
never executed: }
0
68 return db;
never executed: return db;
0
69} -
70 -
71/*! -
72 Accessor for the platform integration's clipboard. -
73 -
74 Default implementation returns a default QPlatformClipboard. -
75 -
76 \sa QPlatformClipboard -
77 -
78*/ -
79 -
80#ifndef QT_NO_CLIPBOARD -
81 -
82QPlatformClipboard *QPlatformIntegration::clipboard() const -
83{ -
84 static QPlatformClipboard *clipboard = 0; -
85 if (!clipboard) {
never evaluated: !clipboard
0
86 clipboard = new QPlatformClipboard;
never executed (the execution status of this line is deduced): clipboard = new QPlatformClipboard;
-
87 }
never executed: }
0
88 return clipboard;
never executed: return clipboard;
0
89} -
90 -
91#endif -
92 -
93#ifndef QT_NO_DRAGANDDROP -
94/*! -
95 Accessor for the platform integration's drag object. -
96 -
97 Default implementation returns 0, implying no drag and drop support. -
98 -
99*/ -
100QPlatformDrag *QPlatformIntegration::drag() const -
101{ -
102 return 0;
never executed: return 0;
0
103} -
104#endif -
105 -
106QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const -
107{ -
108 return 0;
never executed: return 0;
0
109} -
110 -
111QPlatformServices *QPlatformIntegration::services() const -
112{ -
113 return 0;
never executed: return 0;
0
114} -
115 -
116/*! -
117 \class QPlatformIntegration -
118 \since 4.8 -
119 \internal -
120 \preliminary -
121 \ingroup qpa -
122 \brief The QPlatformIntegration class is the entry for WindowSystem specific functionality. -
123 -
124 QPlatformIntegration is the single entry point for windowsystem specific functionality when -
125 using the QPA platform. It has factory functions for creating platform specific pixmaps and -
126 windows. The class also controls the font subsystem. -
127 -
128 QPlatformIntegration is a singleton class which gets instantiated in the QGuiApplication -
129 constructor. The QPlatformIntegration instance do not have ownership of objects it creates in -
130 functions where the name starts with create. However, functions which don't have a name -
131 starting with create acts as accessors to member variables. -
132 -
133 It is not trivial to create or build a platform plugin outside of the Qt source tree. Therefore -
134 the recommended approach for making new platform plugin is to copy an existing plugin inside -
135 the QTSRCTREE/src/plugins/platform and develop the plugin inside the source tree. -
136 -
137 The minimal platform integration is the smallest platform integration it is possible to make, -
138 which makes it an ideal starting point for new plugins. For a slightly more advanced plugin, -
139 consider reviewing the directfb plugin, or the testlite plugin. -
140*/ -
141 -
142/*! -
143 \fn QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const -
144 -
145 Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType. -
146 \sa QPlatformPixmap -
147*/ -
148 -
149/*! -
150 \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWindow *window) const -
151 -
152 Factory function for QPlatformWindow. The \a window parameter is a pointer to the top level -
153 window which the QPlatformWindow is supposed to be created for. -
154 -
155 All top level windows have to have a QPlatformWindow, and it will be created when the -
156 QPlatformWindow is set to be visible for the first time. If the top level window's flags are -
157 changed, or if the top level window's QPlatformWindowFormat is changed, then the top level -
158 window's QPlatformWindow is deleted and a new one is created. -
159 -
160 In the constructor, of the QPlatformWindow, the window flags, state, title and geometry -
161 of the \a window should be applied to the underlying window. If the resulting flags or state -
162 differs, the resulting values should be set on the \a window using QWindow::setWindowFlags() -
163 or QWindow::setWindowState(), respectively. -
164 -
165 \sa QPlatformWindow, QPlatformWindowFormat -
166 \sa createPlatformBackingStore() -
167*/ -
168 -
169/*! -
170 \fn QPlatformBackingStore *QPlatformIntegration::createPlatformBackingStore(QWindow *window) const -
171 -
172 Factory function for QPlatformBackingStore. The QWindow parameter is a pointer to the -
173 top level widget(tlw) the window surface is created for. A QPlatformWindow is always created -
174 before the QPlatformBackingStore for tlw where the widget also requires a backing store. -
175 -
176 \sa QBackingStore -
177 \sa createPlatformWindow() -
178*/ -
179 -
180/*! -
181 \enum QPlatformIntegration::Capability -
182 -
183 Capabilities are used to determing specific features of a platform integration -
184 -
185 \value ThreadedPixmaps The platform uses a pixmap implementation that is reentrant -
186 and can be used from multiple threads, like the raster paint engine and QImage based -
187 pixmaps. -
188 -
189 \value OpenGL The platform supports OpenGL -
190 -
191 \value ThreadedOpenGL The platform supports using OpenGL outside the GUI thread. -
192 -
193 \value SharedGraphicsCache The platform supports a shared graphics cache -
194 -
195 \value BufferQueueingOpenGL The OpenGL implementation on the platform will queue -
196 up buffers when swapBuffers() is called and block only when its buffer pipeline -
197 is full, rather than block immediately. -
198 -
199 \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind -
200 of compositing either client or server side. Some platforms might only support a -
201 single fullscreen window. -
202 */ -
203 -
204 -
205/*! -
206 -
207 \fn QAbstractEventDispatcher *QPlatformIntegration::guiThreadEventDispatcher() const = 0 -
208 -
209 Accessor function for the event dispatcher. The platform plugin should create -
210 an instance of the QAbstractEventDispatcher in its constructor and set it -
211 on the application using QGuiApplicationPrivate::instance()->setEventDispatcher(). -
212 The event dispatcher is owned by QGuiApplication, the accessor should return -
213 a flat pointer. -
214 \sa QGuiApplicationPrivate -
215*/ -
216 -
217bool QPlatformIntegration::hasCapability(Capability cap) const -
218{ -
219 Q_UNUSED(cap);
never executed (the execution status of this line is deduced): (void)cap;;
-
220 return false;
never executed: return false;
0
221} -
222 -
223QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const -
224{ -
225 return new QRasterPlatformPixmap(type);
executed: return new QRasterPlatformPixmap(type);
Execution Count:4952
4952
226} -
227 -
228#ifndef QT_NO_OPENGL -
229QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const -
230{ -
231 Q_UNUSED(context);
never executed (the execution status of this line is deduced): (void)context;;
-
232 qWarning("This plugin does not support createPlatformOpenGLContext!");
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qplatformintegration.cpp", 232, __PRETTY_FUNCTION__).warning("This plugin does not support createPlatformOpenGLContext!");
-
233 return 0;
never executed: return 0;
0
234} -
235#endif -
236 -
237/*! -
238 Factory function for QPlatformSharedGraphicsCache. This function will return 0 if the platform -
239 integration does not support any shared graphics cache mechanism for the given \a cacheId. -
240*/ -
241QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphicsCache(const char *cacheId) const -
242{ -
243 qWarning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!",
never executed (the execution status of this line is deduced): QMessageLogger("kernel/qplatformintegration.cpp", 243, __PRETTY_FUNCTION__).warning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!",
-
244 cacheId);
never executed (the execution status of this line is deduced): cacheId);
-
245 return 0;
never executed: return 0;
0
246} -
247 -
248/*! -
249 Factory function for QPaintEngine. This function will return 0 if the platform -
250 integration does not support creating any paint engine the given \a paintDevice. -
251*/ -
252QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const -
253{ -
254 Q_UNUSED(paintDevice)
executed (the execution status of this line is deduced): (void)paintDevice;
-
255 return 0;
executed: return 0;
Execution Count:5525
5525
256} -
257 -
258/*! -
259 Returns the platforms input context. -
260 -
261 The default implementation returns 0, implying no input method support. -
262*/ -
263QPlatformInputContext *QPlatformIntegration::inputContext() const -
264{ -
265 return 0;
never executed: return 0;
0
266} -
267 -
268#ifndef QT_NO_ACCESSIBILITY -
269 -
270/*! -
271 Returns the platforms accessibility. -
272 -
273 The default implementation returns 0, implying no accessibility support. -
274*/ -
275QPlatformAccessibility *QPlatformIntegration::accessibility() const -
276{ -
277 return 0;
never executed: return 0;
0
278} -
279 -
280#endif -
281 -
282QVariant QPlatformIntegration::styleHint(StyleHint hint) const -
283{ -
284 switch (hint) { -
285 case CursorFlashTime: -
286 return QPlatformTheme::defaultThemeHint(QPlatformTheme::CursorFlashTime);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::CursorFlashTime);
0
287 case KeyboardInputInterval: -
288 return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardInputInterval);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardInputInterval);
0
289 case KeyboardAutoRepeatRate: -
290 return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardAutoRepeatRate);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardAutoRepeatRate);
0
291 case MouseDoubleClickInterval: -
292 return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickInterval);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickInterval);
0
293 case StartDragDistance: -
294 return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragDistance);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragDistance);
0
295 case StartDragTime: -
296 return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime);
0
297 case ShowIsFullScreen: -
298 return false;
executed: return false;
Execution Count:2867
2867
299 case PasswordMaskDelay: -
300 return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay);
0
301 case FontSmoothingGamma: -
302 return qreal(1.7);
executed: return qreal(1.7);
Execution Count:289
289
303 case StartDragVelocity: -
304 return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragVelocity);
never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragVelocity);
0
305 case UseRtlExtensions: -
306 return QVariant(false);
executed: return QVariant(false);
Execution Count:2
2
307 case SynthesizeMouseFromTouchEvents: -
308 return true;
executed: return true;
Execution Count:22
22
309 } -
310 -
311 return 0;
never executed: return 0;
0
312} -
313 -
314Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const -
315{ -
316 return QGuiApplication::keyboardModifiers();
never executed: return QGuiApplication::keyboardModifiers();
0
317} -
318 -
319/*! -
320 Should be used to obtain a list of possible shortcuts for the given key -
321 event. As that needs system functionality it cannot be done in qkeymapper. -
322 -
323 One example for more than 1 possibility is the key combination of Shift+5. -
324 That one might trigger a shortcut which is set as "Shift+5" as well as one -
325 using %. These combinations depend on the currently set keyboard layout -
326 which cannot be obtained by Qt functionality. -
327*/ -
328QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const -
329{ -
330 return QList<int>();
never executed: return QList<int>();
0
331} -
332 -
333/*! -
334 Should be called by the implementation whenever a new screen is added. -
335 -
336 The first screen added will be the primary screen, used for default-created -
337 windows, GL contexts, and other resources unless otherwise specified. -
338 -
339 This adds the screen to QGuiApplication::screens(), and emits the -
340 QGuiApplication::screenAdded() signal. -
341 -
342 The screen is automatically removed when the QPlatformScreen is destroyed. -
343*/ -
344void QPlatformIntegration::screenAdded(QPlatformScreen *ps) -
345{ -
346 QScreen *screen = new QScreen(ps);
executed (the execution status of this line is deduced): QScreen *screen = new QScreen(ps);
-
347 ps->d_func()->screen = screen;
executed (the execution status of this line is deduced): ps->d_func()->screen = screen;
-
348 QGuiApplicationPrivate::screen_list << screen;
executed (the execution status of this line is deduced): QGuiApplicationPrivate::screen_list << screen;
-
349 emit qGuiApp->screenAdded(screen);
executed (the execution status of this line is deduced): (static_cast<QGuiApplication *>(QCoreApplication::instance()))->screenAdded(screen);
-
350}
executed: }
Execution Count:289
289
351 -
352QStringList QPlatformIntegration::themeNames() const -
353{ -
354 return QStringList();
never executed: return QStringList();
0
355} -
356 -
357class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &name) const -
358{ -
359 Q_UNUSED(name)
never executed (the execution status of this line is deduced): (void)name;
-
360 return new QPlatformTheme;
never executed: return new QPlatformTheme;
0
361} -
362 -
363QT_END_NAMESPACE -
364 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial