kernel/qstylehints.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 <qstylehints.h> -
43#include <qpa/qplatformintegration.h> -
44#include <qpa/qplatformtheme.h> -
45#include <private/qguiapplication_p.h> -
46 -
47QT_BEGIN_NAMESPACE -
48 -
49static inline QVariant hint(QPlatformIntegration::StyleHint h) -
50{ -
51 return QGuiApplicationPrivate::platformIntegration()->styleHint(h);
executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(h);
Execution Count:2869
2869
52} -
53 -
54static inline QVariant themeableHint(QPlatformTheme::ThemeHint th, -
55 QPlatformIntegration::StyleHint ih) -
56{ -
57 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()
TRUEFALSE
yes
Evaluation Count:5015
no
Evaluation Count:0
0-5015
58 const QVariant themeHint = theme->themeHint(th);
executed (the execution status of this line is deduced): const QVariant themeHint = theme->themeHint(th);
-
59 if (themeHint.isValid())
partially evaluated: themeHint.isValid()
TRUEFALSE
yes
Evaluation Count:5015
no
Evaluation Count:0
0-5015
60 return themeHint;
executed: return themeHint;
Execution Count:5015
5015
61 }
never executed: }
0
62 return QGuiApplicationPrivate::platformIntegration()->styleHint(ih);
never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(ih);
0
63} -
64 -
65/*! -
66 \class QStyleHints -
67 \since 5.0 -
68 \brief The QStyleHints class contains platform specific hints and settings. -
69 \inmodule QtGui -
70 -
71 An object of this class, obtained from QGuiApplication, provides access to certain global -
72 user interface parameters of the current platform. -
73 -
74 Access is read only; typically the platform itself provides the user a way to tune these -
75 parameters. -
76 -
77 Access to these parameters are useful when implementing custom user interface components, in that -
78 they allow the components to exhibit the same behaviour and feel as other components. -
79 -
80 \sa QGuiApplication::styleHints(), QPlatformTheme -
81 */ -
82QStyleHints::QStyleHints() -
83 : QObject() -
84{ -
85}
executed: }
Execution Count:117
117
86 -
87/*! -
88 Returns the time limit in milliseconds that distinguishes a double click -
89 from two consecutive mouse clicks. -
90*/ -
91int QStyleHints::mouseDoubleClickInterval() const -
92{ -
93 return themeableHint(QPlatformTheme::MouseDoubleClickInterval, QPlatformIntegration::MouseDoubleClickInterval).toInt();
executed: return themeableHint(QPlatformTheme::MouseDoubleClickInterval, QPlatformIntegration::MouseDoubleClickInterval).toInt();
Execution Count:785
785
94} -
95 -
96/*! -
97 Returns the distance, in pixels, that the mouse must be moved with a button -
98 held down before a drag and drop operation will begin. -
99 -
100 If you support drag and drop in your application, and want to start a drag -
101 and drop operation after the user has moved the cursor a certain distance -
102 with a button held down, you should use this property's value as the -
103 minimum distance required. -
104 -
105 For example, if the mouse position of the click is stored in \c startPos -
106 and the current position (e.g. in the mouse move event) is \c currentPos, -
107 you can find out if a drag should be started with code like this: -
108 -
109 \snippet code/src_gui_kernel_qapplication.cpp 7 -
110 -
111 \sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop} -
112*/ -
113int QStyleHints::startDragDistance() const -
114{ -
115 return themeableHint(QPlatformTheme::StartDragDistance, QPlatformIntegration::StartDragDistance).toInt();
executed: return themeableHint(QPlatformTheme::StartDragDistance, QPlatformIntegration::StartDragDistance).toInt();
Execution Count:9
9
116} -
117 -
118/*! -
119 Returns the time, in milliseconds, that a mouse button must be held down -
120 before a drag and drop operation will begin. -
121 -
122 If you support drag and drop in your application, and want to start a drag -
123 and drop operation after the user has held down a mouse button for a -
124 certain amount of time, you should use this property's value as the delay. -
125 -
126 \sa startDragDistance(), {Drag and Drop} -
127*/ -
128int QStyleHints::startDragTime() const -
129{ -
130 return themeableHint(QPlatformTheme::StartDragTime, QPlatformIntegration::StartDragTime).toInt();
never executed: return themeableHint(QPlatformTheme::StartDragTime, QPlatformIntegration::StartDragTime).toInt();
0
131} -
132 -
133/*! -
134 Returns the limit for the velocity, in pixels per second, that the mouse may -
135 be moved, with a button held down, for a drag and drop operation to begin. -
136 A value of 0 means there is no such limit. -
137 -
138 \sa startDragDistance(), {Drag and Drop} -
139*/ -
140int QStyleHints::startDragVelocity() const -
141{ -
142 return themeableHint(QPlatformTheme::StartDragVelocity, QPlatformIntegration::StartDragVelocity).toInt();
never executed: return themeableHint(QPlatformTheme::StartDragVelocity, QPlatformIntegration::StartDragVelocity).toInt();
0
143} -
144 -
145/*! -
146 Returns the time limit, in milliseconds, that distinguishes a key press -
147 from two consecutive key presses. -
148*/ -
149int QStyleHints::keyboardInputInterval() const -
150{ -
151 return themeableHint(QPlatformTheme::KeyboardInputInterval, QPlatformIntegration::KeyboardInputInterval).toInt();
executed: return themeableHint(QPlatformTheme::KeyboardInputInterval, QPlatformIntegration::KeyboardInputInterval).toInt();
Execution Count:19
19
152} -
153 -
154/*! -
155 Returns the rate, in events per second, in which additional repeated key -
156 presses will automatically be generated if a key is being held down. -
157*/ -
158int QStyleHints::keyboardAutoRepeatRate() const -
159{ -
160 return themeableHint(QPlatformTheme::KeyboardAutoRepeatRate, QPlatformIntegration::KeyboardAutoRepeatRate).toInt();
never executed: return themeableHint(QPlatformTheme::KeyboardAutoRepeatRate, QPlatformIntegration::KeyboardAutoRepeatRate).toInt();
0
161} -
162 -
163/*! -
164 Returns the text cursor's flash (blink) time in milliseconds. -
165 -
166 The flash time is the time used to display, invert and restore the -
167 caret display. Usually the text cursor is displayed for half the cursor -
168 flash time, then hidden for the same amount of time. -
169*/ -
170int QStyleHints::cursorFlashTime() const -
171{ -
172 return themeableHint(QPlatformTheme::CursorFlashTime, QPlatformIntegration::CursorFlashTime).toInt();
executed: return themeableHint(QPlatformTheme::CursorFlashTime, QPlatformIntegration::CursorFlashTime).toInt();
Execution Count:4198
4198
173} -
174 -
175/*! -
176 Returns \c true if the platform defaults to windows being fullscreen, -
177 otherwise \c false. -
178 -
179 \sa QWindow::show() -
180*/ -
181bool QStyleHints::showIsFullScreen() const -
182{ -
183 return hint(QPlatformIntegration::ShowIsFullScreen).toBool();
executed: return hint(QPlatformIntegration::ShowIsFullScreen).toBool();
Execution Count:2867
2867
184} -
185 -
186/*! -
187 Returns the time, in milliseconds, a typed letter is displayed unshrouded -
188 in a text input field in password mode. -
189*/ -
190int QStyleHints::passwordMaskDelay() const -
191{ -
192 return themeableHint(QPlatformTheme::PasswordMaskDelay, QPlatformIntegration::PasswordMaskDelay).toInt();
executed: return themeableHint(QPlatformTheme::PasswordMaskDelay, QPlatformIntegration::PasswordMaskDelay).toInt();
Execution Count:4
4
193} -
194 -
195/*! -
196 Returns the gamma value used in font smoothing. -
197*/ -
198qreal QStyleHints::fontSmoothingGamma() const -
199{ -
200 return hint(QPlatformIntegration::FontSmoothingGamma).toReal();
never executed: return hint(QPlatformIntegration::FontSmoothingGamma).toReal();
0
201} -
202 -
203/*! -
204 Returns \c true if right-to-left writing direction is enabled, -
205 otherwise \c false. -
206*/ -
207bool QStyleHints::useRtlExtensions() const -
208{ -
209 return hint(QPlatformIntegration::UseRtlExtensions).toBool();
executed: return hint(QPlatformIntegration::UseRtlExtensions).toBool();
Execution Count:2
2
210} -
211 -
212QT_END_NAMESPACE -
213 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial