styles/qstylehelper.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2012 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 <qstyleoption.h> -
43#include <qpainter.h> -
44#include <qpixmapcache.h> -
45#include <private/qmath_p.h> -
46#include <private/qstyle_p.h> -
47#include <qmath.h> -
48 -
49#include "qstylehelper_p.h" -
50#include <qstringbuilder.h> -
51 -
52QT_BEGIN_NAMESPACE -
53 -
54Q_GUI_EXPORT int qt_defaultDpiX(); -
55 -
56namespace QStyleHelper { -
57 -
58QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) -
59{ -
60 const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
executed (the execution status of this line is deduced): const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
-
61 QString tmp = key % HexString<uint>(option->state)
executed (the execution status of this line is deduced): QString tmp = key % HexString<uint>(option->state)
-
62 % HexString<uint>(option->direction)
executed (the execution status of this line is deduced): % HexString<uint>(option->direction)
-
63 % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
executed (the execution status of this line is deduced): % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
-
64 % HexString<quint64>(option->palette.cacheKey())
executed (the execution status of this line is deduced): % HexString<quint64>(option->palette.cacheKey())
-
65 % HexString<uint>(size.width())
executed (the execution status of this line is deduced): % HexString<uint>(size.width())
-
66 % HexString<uint>(size.height());
executed (the execution status of this line is deduced): % HexString<uint>(size.height());
-
67 -
68#ifndef QT_NO_SPINBOX -
69 if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
evaluated: const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1436
3-1436
70 tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
executed (the execution status of this line is deduced): tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
-
71 % HexString<uint>(spinBox->stepEnabled)
executed (the execution status of this line is deduced): % HexString<uint>(spinBox->stepEnabled)
-
72 % QLatin1Char(spinBox->frame ? '1' : '0'); ;
executed (the execution status of this line is deduced): % QLatin1Char(spinBox->frame ? '1' : '0'); ;
-
73 }
executed: }
Execution Count:3
3
74#endif // QT_NO_SPINBOX -
75 return tmp;
executed: return tmp;
Execution Count:1439
1439
76} -
77 -
78qreal dpiScaled(qreal value) -
79{ -
80#ifdef Q_OS_MAC -
81 // On mac the DPI is always 72 so we should not scale it -
82 return value; -
83#else -
84 static const qreal scale = qreal(qt_defaultDpiX()) / 96.0; -
85 return value * scale;
executed: return value * scale;
Execution Count:215013
215013
86#endif -
87} -
88 -
89bool isInstanceOf(QObject *obj, QAccessible::Role role) -
90{ -
91 bool match = false;
never executed (the execution status of this line is deduced): bool match = false;
-
92#ifndef QT_NO_ACCESSIBILITY -
93 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(obj);
never executed (the execution status of this line is deduced): QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(obj);
-
94 match = iface && iface->role() == role;
never evaluated: iface
never evaluated: iface->role() == role
0
95 delete iface;
never executed (the execution status of this line is deduced): delete iface;
-
96#else -
97 Q_UNUSED(obj) -
98 Q_UNUSED(role) -
99#endif // QT_NO_ACCESSIBILITY -
100 return match;
never executed: return match;
0
101} -
102 -
103// Searches for an ancestor of a particular accessible role -
104bool hasAncestor(QObject *obj, QAccessible::Role role) -
105{ -
106 bool found = false;
never executed (the execution status of this line is deduced): bool found = false;
-
107#ifndef QT_NO_ACCESSIBILITY -
108 QObject *parent = obj ? obj->parent() : 0;
never evaluated: obj
0
109 while (parent && !found) {
never evaluated: parent
never evaluated: !found
0
110 if (isInstanceOf(parent, role))
never evaluated: isInstanceOf(parent, role)
0
111 found = true;
never executed: found = true;
0
112 parent = parent->parent();
never executed (the execution status of this line is deduced): parent = parent->parent();
-
113 }
never executed: }
0
114#else -
115 Q_UNUSED(obj) -
116 Q_UNUSED(role) -
117#endif // QT_NO_ACCESSIBILITY -
118 return found;
never executed: return found;
0
119} -
120 -
121 -
122#ifndef QT_NO_DIAL -
123 -
124int calcBigLineSize(int radius) -
125{ -
126 int bigLineSize = radius / 6;
executed (the execution status of this line is deduced): int bigLineSize = radius / 6;
-
127 if (bigLineSize < 4)
partially evaluated: bigLineSize < 4
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
128 bigLineSize = 4;
never executed: bigLineSize = 4;
0
129 if (bigLineSize > radius / 2)
partially evaluated: bigLineSize > radius / 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
130 bigLineSize = radius / 2;
never executed: bigLineSize = radius / 2;
0
131 return bigLineSize;
executed: return bigLineSize;
Execution Count:10
10
132} -
133 -
134static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset) -
135{ -
136 const int width = dial->rect.width();
executed (the execution status of this line is deduced): const int width = dial->rect.width();
-
137 const int height = dial->rect.height();
executed (the execution status of this line is deduced): const int height = dial->rect.height();
-
138 const int r = qMin(width, height) / 2;
executed (the execution status of this line is deduced): const int r = qMin(width, height) / 2;
-
139 const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
partially evaluated: dial->upsideDown
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
140 qreal a = 0;
executed (the execution status of this line is deduced): qreal a = 0;
-
141 if (dial->maximum == dial->minimum)
partially evaluated: dial->maximum == dial->minimum
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
142 a = Q_PI / 2;
never executed: a = Q_PI / 2;
0
143 else if (dial->dialWrapping)
partially evaluated: dial->dialWrapping
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
144 a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI
never executed: a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI / (dial->maximum - dial->minimum);
0
145 / (dial->maximum - dial->minimum);
never executed: a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI / (dial->maximum - dial->minimum);
0
146 else -
147 a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI
executed: a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI / (dial->maximum - dial->minimum)) / 6;
Execution Count:3
3
148 / (dial->maximum - dial->minimum)) / 6;
executed: a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI / (dial->maximum - dial->minimum)) / 6;
Execution Count:3
3
149 qreal xc = width / 2.0;
executed (the execution status of this line is deduced): qreal xc = width / 2.0;
-
150 qreal yc = height / 2.0;
executed (the execution status of this line is deduced): qreal yc = height / 2.0;
-
151 qreal len = r - QStyleHelper::calcBigLineSize(r) - 3;
executed (the execution status of this line is deduced): qreal len = r - QStyleHelper::calcBigLineSize(r) - 3;
-
152 qreal back = offset * len;
executed (the execution status of this line is deduced): qreal back = offset * len;
-
153 QPointF pos(QPointF(xc + back * qCos(a), yc - back * qSin(a)));
executed (the execution status of this line is deduced): QPointF pos(QPointF(xc + back * qCos(a), yc - back * qSin(a)));
-
154 return pos;
executed: return pos;
Execution Count:3
3
155} -
156 -
157qreal angle(const QPointF &p1, const QPointF &p2) -
158{ -
159 static const qreal rad_factor = 180 / Q_PI; -
160 qreal _angle = 0;
executed (the execution status of this line is deduced): qreal _angle = 0;
-
161 -
162 if (p1.x() == p2.x()) {
partially evaluated: p1.x() == p2.x()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
163 if (p1.y() < p2.y())
never evaluated: p1.y() < p2.y()
0
164 _angle = 270;
never executed: _angle = 270;
0
165 else -
166 _angle = 90;
never executed: _angle = 90;
0
167 } else { -
168 qreal x1, x2, y1, y2;
executed (the execution status of this line is deduced): qreal x1, x2, y1, y2;
-
169 -
170 if (p1.x() <= p2.x()) {
partially evaluated: p1.x() <= p2.x()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
171 x1 = p1.x(); y1 = p1.y();
executed (the execution status of this line is deduced): x1 = p1.x(); y1 = p1.y();
-
172 x2 = p2.x(); y2 = p2.y();
executed (the execution status of this line is deduced): x2 = p2.x(); y2 = p2.y();
-
173 } else {
executed: }
Execution Count:3
3
174 x2 = p1.x(); y2 = p1.y();
never executed (the execution status of this line is deduced): x2 = p1.x(); y2 = p1.y();
-
175 x1 = p2.x(); y1 = p2.y();
never executed (the execution status of this line is deduced): x1 = p2.x(); y1 = p2.y();
-
176 }
never executed: }
0
177 -
178 qreal m = -(y2 - y1) / (x2 - x1);
executed (the execution status of this line is deduced): qreal m = -(y2 - y1) / (x2 - x1);
-
179 _angle = qAtan(m) * rad_factor;
executed (the execution status of this line is deduced): _angle = qAtan(m) * rad_factor;
-
180 -
181 if (p1.x() < p2.x())
partially evaluated: p1.x() < p2.x()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
182 _angle = 180 - _angle;
executed: _angle = 180 - _angle;
Execution Count:3
3
183 else -
184 _angle = -_angle;
never executed: _angle = -_angle;
0
185 } -
186 return _angle;
executed: return _angle;
Execution Count:3
3
187} -
188 -
189QPolygonF calcLines(const QStyleOptionSlider *dial) -
190{ -
191 QPolygonF poly;
executed (the execution status of this line is deduced): QPolygonF poly;
-
192 int width = dial->rect.width();
executed (the execution status of this line is deduced): int width = dial->rect.width();
-
193 int height = dial->rect.height();
executed (the execution status of this line is deduced): int height = dial->rect.height();
-
194 qreal r = qMin(width, height) / 2;
executed (the execution status of this line is deduced): qreal r = qMin(width, height) / 2;
-
195 int bigLineSize = calcBigLineSize(int(r));
executed (the execution status of this line is deduced): int bigLineSize = calcBigLineSize(int(r));
-
196 -
197 qreal xc = width / 2 + 0.5;
executed (the execution status of this line is deduced): qreal xc = width / 2 + 0.5;
-
198 qreal yc = height / 2 + 0.5;
executed (the execution status of this line is deduced): qreal yc = height / 2 + 0.5;
-
199 const int ns = dial->tickInterval;
executed (the execution status of this line is deduced): const int ns = dial->tickInterval;
-
200 if (!ns) // Invalid values may be set by Qt Designer.
partially evaluated: !ns
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
201 return poly;
never executed: return poly;
0
202 int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
executed (the execution status of this line is deduced): int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
-
203 if (notches <= 0)
partially evaluated: notches <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
204 return poly;
never executed: return poly;
0
205 if (dial->maximum < dial->minimum || dial->maximum - dial->minimum > 1000) {
partially evaluated: dial->maximum < dial->minimum
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: dial->maximum - dial->minimum > 1000
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
206 int maximum = dial->minimum + 1000;
never executed (the execution status of this line is deduced): int maximum = dial->minimum + 1000;
-
207 notches = (maximum + ns - 1 - dial->minimum) / ns;
never executed (the execution status of this line is deduced): notches = (maximum + ns - 1 - dial->minimum) / ns;
-
208 }
never executed: }
0
209 -
210 poly.resize(2 + 2 * notches);
executed (the execution status of this line is deduced): poly.resize(2 + 2 * notches);
-
211 int smallLineSize = bigLineSize / 2;
executed (the execution status of this line is deduced): int smallLineSize = bigLineSize / 2;
-
212 for (int i = 0; i <= notches; ++i) {
evaluated: i <= notches
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:4
4-20
213 qreal angle = dial->dialWrapping ? Q_PI * 3 / 2 - i * 2 * Q_PI / notches
partially evaluated: dial->dialWrapping
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
214 : (Q_PI * 8 - i * 10 * Q_PI / notches) / 6;
executed (the execution status of this line is deduced): : (Q_PI * 8 - i * 10 * Q_PI / notches) / 6;
-
215 qreal s = qSin(angle);
executed (the execution status of this line is deduced): qreal s = qSin(angle);
-
216 qreal c = qCos(angle);
executed (the execution status of this line is deduced): qreal c = qCos(angle);
-
217 if (i == 0 || (((ns * i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
evaluated: i == 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:16
partially evaluated: (((ns * i) % (dial->pageStep ? dial->pageStep : 1)) == 0)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
partially evaluated: dial->pageStep
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
218 poly[2 * i] = QPointF(xc + (r - bigLineSize) * c,
executed (the execution status of this line is deduced): poly[2 * i] = QPointF(xc + (r - bigLineSize) * c,
-
219 yc - (r - bigLineSize) * s);
executed (the execution status of this line is deduced): yc - (r - bigLineSize) * s);
-
220 poly[2 * i + 1] = QPointF(xc + r * c, yc - r * s);
executed (the execution status of this line is deduced): poly[2 * i + 1] = QPointF(xc + r * c, yc - r * s);
-
221 } else {
executed: }
Execution Count:20
20
222 poly[2 * i] = QPointF(xc + (r - 1 - smallLineSize) * c,
never executed (the execution status of this line is deduced): poly[2 * i] = QPointF(xc + (r - 1 - smallLineSize) * c,
-
223 yc - (r - 1 - smallLineSize) * s);
never executed (the execution status of this line is deduced): yc - (r - 1 - smallLineSize) * s);
-
224 poly[2 * i + 1] = QPointF(xc + (r - 1) * c, yc -(r - 1) * s);
never executed (the execution status of this line is deduced): poly[2 * i + 1] = QPointF(xc + (r - 1) * c, yc -(r - 1) * s);
-
225 }
never executed: }
0
226 } -
227 return poly;
executed: return poly;
Execution Count:4
4
228} -
229 -
230// This will draw a nice and shiny QDial for us. We don't want -
231// all the shinyness in QWindowsStyle, hence we place it here -
232 -
233void drawDial(const QStyleOptionSlider *option, QPainter *painter) -
234{ -
235 QPalette pal = option->palette;
executed (the execution status of this line is deduced): QPalette pal = option->palette;
-
236 QColor buttonColor = pal.button().color();
executed (the execution status of this line is deduced): QColor buttonColor = pal.button().color();
-
237 const int width = option->rect.width();
executed (the execution status of this line is deduced): const int width = option->rect.width();
-
238 const int height = option->rect.height();
executed (the execution status of this line is deduced): const int height = option->rect.height();
-
239 const bool enabled = option->state & QStyle::State_Enabled;
executed (the execution status of this line is deduced): const bool enabled = option->state & QStyle::State_Enabled;
-
240 qreal r = qMin(width, height) / 2;
executed (the execution status of this line is deduced): qreal r = qMin(width, height) / 2;
-
241 r -= r/50;
executed (the execution status of this line is deduced): r -= r/50;
-
242 const qreal penSize = r/20.0;
executed (the execution status of this line is deduced): const qreal penSize = r/20.0;
-
243 -
244 painter->save();
executed (the execution status of this line is deduced): painter->save();
-
245 painter->setRenderHint(QPainter::Antialiasing);
executed (the execution status of this line is deduced): painter->setRenderHint(QPainter::Antialiasing);
-
246 -
247 // Draw notches -
248 if (option->subControls & QStyle::SC_DialTickmarks) {
partially evaluated: option->subControls & QStyle::SC_DialTickmarks
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
249 painter->setPen(option->palette.dark().color().darker(120));
executed (the execution status of this line is deduced): painter->setPen(option->palette.dark().color().darker(120));
-
250 painter->drawLines(QStyleHelper::calcLines(option));
executed (the execution status of this line is deduced): painter->drawLines(QStyleHelper::calcLines(option));
-
251 }
executed: }
Execution Count:1
1
252 -
253 // Cache dial background -
254 BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("qdial"));
never executed: }
executed: }
Execution Count:1
partially evaluated: doPixmapCache
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: (txType <= QTransform::TxTranslate)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
never evaluated: (painter->deviceTransform().type() == QTransform::TxScale)
partially evaluated: doPixmapCache
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: QPixmapCache::find(unique, internalPixmapCache)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
255 p->setRenderHint(QPainter::Antialiasing);
executed (the execution status of this line is deduced): p->setRenderHint(QPainter::Antialiasing);
-
256 -
257 const qreal d_ = r / 6;
executed (the execution status of this line is deduced): const qreal d_ = r / 6;
-
258 const qreal dx = option->rect.x() + d_ + (width - 2 * r) / 2 + 1;
executed (the execution status of this line is deduced): const qreal dx = option->rect.x() + d_ + (width - 2 * r) / 2 + 1;
-
259 const qreal dy = option->rect.y() + d_ + (height - 2 * r) / 2 + 1;
executed (the execution status of this line is deduced): const qreal dy = option->rect.y() + d_ + (height - 2 * r) / 2 + 1;
-
260 -
261 QRectF br = QRectF(dx + 0.5, dy + 0.5,
executed (the execution status of this line is deduced): QRectF br = QRectF(dx + 0.5, dy + 0.5,
-
262 int(r * 2 - 2 * d_ - 2),
executed (the execution status of this line is deduced): int(r * 2 - 2 * d_ - 2),
-
263 int(r * 2 - 2 * d_ - 2));
executed (the execution status of this line is deduced): int(r * 2 - 2 * d_ - 2));
-
264 buttonColor.setHsv(buttonColor .hue(),
executed (the execution status of this line is deduced): buttonColor.setHsv(buttonColor .hue(),
-
265 qMin(140, buttonColor .saturation()),
executed (the execution status of this line is deduced): qMin(140, buttonColor .saturation()),
-
266 qMax(180, buttonColor.value()));
executed (the execution status of this line is deduced): qMax(180, buttonColor.value()));
-
267 QColor shadowColor(0, 0, 0, 20);
executed (the execution status of this line is deduced): QColor shadowColor(0, 0, 0, 20);
-
268 -
269 if (enabled) {
partially evaluated: enabled
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
270 // Drop shadow -
271 qreal shadowSize = qMax(1.0, penSize/2.0);
executed (the execution status of this line is deduced): qreal shadowSize = qMax(1.0, penSize/2.0);
-
272 QRectF shadowRect= br.adjusted(-2*shadowSize, -2*shadowSize,
executed (the execution status of this line is deduced): QRectF shadowRect= br.adjusted(-2*shadowSize, -2*shadowSize,
-
273 2*shadowSize, 2*shadowSize);
executed (the execution status of this line is deduced): 2*shadowSize, 2*shadowSize);
-
274 QRadialGradient shadowGradient(shadowRect.center().x(),
executed (the execution status of this line is deduced): QRadialGradient shadowGradient(shadowRect.center().x(),
-
275 shadowRect.center().y(), shadowRect.width()/2.0,
executed (the execution status of this line is deduced): shadowRect.center().y(), shadowRect.width()/2.0,
-
276 shadowRect.center().x(), shadowRect.center().y());
executed (the execution status of this line is deduced): shadowRect.center().x(), shadowRect.center().y());
-
277 shadowGradient.setColorAt(qreal(0.91), QColor(0, 0, 0, 40));
executed (the execution status of this line is deduced): shadowGradient.setColorAt(qreal(0.91), QColor(0, 0, 0, 40));
-
278 shadowGradient.setColorAt(qreal(1.0), Qt::transparent);
executed (the execution status of this line is deduced): shadowGradient.setColorAt(qreal(1.0), Qt::transparent);
-
279 p->setBrush(shadowGradient);
executed (the execution status of this line is deduced): p->setBrush(shadowGradient);
-
280 p->setPen(Qt::NoPen);
executed (the execution status of this line is deduced): p->setPen(Qt::NoPen);
-
281 p->translate(shadowSize, shadowSize);
executed (the execution status of this line is deduced): p->translate(shadowSize, shadowSize);
-
282 p->drawEllipse(shadowRect);
executed (the execution status of this line is deduced): p->drawEllipse(shadowRect);
-
283 p->translate(-shadowSize, -shadowSize);
executed (the execution status of this line is deduced): p->translate(-shadowSize, -shadowSize);
-
284 -
285 // Main gradient -
286 QRadialGradient gradient(br.center().x() - br.width()/3, dy,
executed (the execution status of this line is deduced): QRadialGradient gradient(br.center().x() - br.width()/3, dy,
-
287 br.width()*1.3, br.center().x(),
executed (the execution status of this line is deduced): br.width()*1.3, br.center().x(),
-
288 br.center().y() - br.height()/2);
executed (the execution status of this line is deduced): br.center().y() - br.height()/2);
-
289 gradient.setColorAt(0, buttonColor.lighter(110));
executed (the execution status of this line is deduced): gradient.setColorAt(0, buttonColor.lighter(110));
-
290 gradient.setColorAt(qreal(0.5), buttonColor);
executed (the execution status of this line is deduced): gradient.setColorAt(qreal(0.5), buttonColor);
-
291 gradient.setColorAt(qreal(0.501), buttonColor.darker(102));
executed (the execution status of this line is deduced): gradient.setColorAt(qreal(0.501), buttonColor.darker(102));
-
292 gradient.setColorAt(1, buttonColor.darker(115));
executed (the execution status of this line is deduced): gradient.setColorAt(1, buttonColor.darker(115));
-
293 p->setBrush(gradient);
executed (the execution status of this line is deduced): p->setBrush(gradient);
-
294 } else {
executed: }
Execution Count:1
1
295 p->setBrush(Qt::NoBrush);
never executed (the execution status of this line is deduced): p->setBrush(Qt::NoBrush);
-
296 }
never executed: }
0
297 -
298 p->setPen(QPen(buttonColor.darker(280)));
executed (the execution status of this line is deduced): p->setPen(QPen(buttonColor.darker(280)));
-
299 p->drawEllipse(br);
executed (the execution status of this line is deduced): p->drawEllipse(br);
-
300 p->setBrush(Qt::NoBrush);
executed (the execution status of this line is deduced): p->setBrush(Qt::NoBrush);
-
301 p->setPen(buttonColor.lighter(110));
executed (the execution status of this line is deduced): p->setPen(buttonColor.lighter(110));
-
302 p->drawEllipse(br.adjusted(1, 1, -1, -1));
executed (the execution status of this line is deduced): p->drawEllipse(br.adjusted(1, 1, -1, -1));
-
303 -
304 if (option->state & QStyle::State_HasFocus) {
partially evaluated: option->state & QStyle::State_HasFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
305 QColor highlight = pal.highlight().color();
never executed (the execution status of this line is deduced): QColor highlight = pal.highlight().color();
-
306 highlight.setHsv(highlight.hue(),
never executed (the execution status of this line is deduced): highlight.setHsv(highlight.hue(),
-
307 qMin(160, highlight.saturation()),
never executed (the execution status of this line is deduced): qMin(160, highlight.saturation()),
-
308 qMax(230, highlight.value()));
never executed (the execution status of this line is deduced): qMax(230, highlight.value()));
-
309 highlight.setAlpha(127);
never executed (the execution status of this line is deduced): highlight.setAlpha(127);
-
310 p->setPen(QPen(highlight, 2.0));
never executed (the execution status of this line is deduced): p->setPen(QPen(highlight, 2.0));
-
311 p->setBrush(Qt::NoBrush);
never executed (the execution status of this line is deduced): p->setBrush(Qt::NoBrush);
-
312 p->drawEllipse(br.adjusted(-1, -1, 1, 1));
never executed (the execution status of this line is deduced): p->drawEllipse(br.adjusted(-1, -1, 1, 1));
-
313 }
never executed: }
0
314 -
315 END_STYLE_PIXMAPCACHE
executed: }
Execution Count:1
executed: }
Execution Count:1
partially evaluated: doPixmapCache
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
316 -
317 QPointF dp = calcRadialPos(option, qreal(0.70));
executed (the execution status of this line is deduced): QPointF dp = calcRadialPos(option, qreal(0.70));
-
318 buttonColor = buttonColor.lighter(104);
executed (the execution status of this line is deduced): buttonColor = buttonColor.lighter(104);
-
319 buttonColor.setAlphaF(qreal(0.8));
executed (the execution status of this line is deduced): buttonColor.setAlphaF(qreal(0.8));
-
320 const qreal ds = r/qreal(7.0);
executed (the execution status of this line is deduced): const qreal ds = r/qreal(7.0);
-
321 QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
executed (the execution status of this line is deduced): QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
-
322 QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
executed (the execution status of this line is deduced): QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
-
323 dialRect.center().y() + dialRect.width(),
executed (the execution status of this line is deduced): dialRect.center().y() + dialRect.width(),
-
324 dialRect.width()*2,
executed (the execution status of this line is deduced): dialRect.width()*2,
-
325 dialRect.center().x(), dialRect.center().y());
executed (the execution status of this line is deduced): dialRect.center().x(), dialRect.center().y());
-
326 dialGradient.setColorAt(1, buttonColor.darker(140));
executed (the execution status of this line is deduced): dialGradient.setColorAt(1, buttonColor.darker(140));
-
327 dialGradient.setColorAt(qreal(0.4), buttonColor.darker(120));
executed (the execution status of this line is deduced): dialGradient.setColorAt(qreal(0.4), buttonColor.darker(120));
-
328 dialGradient.setColorAt(0, buttonColor.darker(110));
executed (the execution status of this line is deduced): dialGradient.setColorAt(0, buttonColor.darker(110));
-
329 if (penSize > 3.0) {
partially evaluated: penSize > 3.0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
330 painter->setPen(QPen(QColor(0, 0, 0, 25), penSize));
executed (the execution status of this line is deduced): painter->setPen(QPen(QColor(0, 0, 0, 25), penSize));
-
331 painter->drawLine(calcRadialPos(option, qreal(0.90)), calcRadialPos(option, qreal(0.96)));
executed (the execution status of this line is deduced): painter->drawLine(calcRadialPos(option, qreal(0.90)), calcRadialPos(option, qreal(0.96)));
-
332 }
executed: }
Execution Count:1
1
333 -
334 painter->setBrush(dialGradient);
executed (the execution status of this line is deduced): painter->setBrush(dialGradient);
-
335 painter->setPen(QColor(255, 255, 255, 150));
executed (the execution status of this line is deduced): painter->setPen(QColor(255, 255, 255, 150));
-
336 painter->drawEllipse(dialRect.adjusted(-1, -1, 1, 1));
executed (the execution status of this line is deduced): painter->drawEllipse(dialRect.adjusted(-1, -1, 1, 1));
-
337 painter->setPen(QColor(0, 0, 0, 80));
executed (the execution status of this line is deduced): painter->setPen(QColor(0, 0, 0, 80));
-
338 painter->drawEllipse(dialRect);
executed (the execution status of this line is deduced): painter->drawEllipse(dialRect);
-
339 painter->restore();
executed (the execution status of this line is deduced): painter->restore();
-
340}
executed: }
Execution Count:1
1
341#endif //QT_NO_DIAL -
342 -
343void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, -
344 int left, int top, int right, -
345 int bottom) -
346{ -
347 QSize size = pixmap.size();
never executed (the execution status of this line is deduced): QSize size = pixmap.size();
-
348 //painter->setRenderHint(QPainter::SmoothPixmapTransform); -
349 -
350 //top -
351 if (top > 0) {
never evaluated: top > 0
0
352 painter->drawPixmap(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), pixmap,
never executed (the execution status of this line is deduced): painter->drawPixmap(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), pixmap,
-
353 QRect(left, 0, size.width() -right - left, top));
never executed (the execution status of this line is deduced): QRect(left, 0, size.width() -right - left, top));
-
354 -
355 //top-left -
356 if(left > 0)
never evaluated: left > 0
0
357 painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap,
never executed: painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap, QRect(0, 0, left, top));
0
358 QRect(0, 0, left, top));
never executed: painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap, QRect(0, 0, left, top));
0
359 -
360 //top-right -
361 if (right > 0)
never evaluated: right > 0
0
362 painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top(), right, top), pixmap,
never executed: painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top(), right, top), pixmap, QRect(size.width() - right, 0, right, top));
0
363 QRect(size.width() - right, 0, right, top));
never executed: painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top(), right, top), pixmap, QRect(size.width() - right, 0, right, top));
0
364 }
never executed: }
0
365 -
366 //left -
367 if (left > 0)
never evaluated: left > 0
0
368 painter->drawPixmap(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), pixmap,
never executed: painter->drawPixmap(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), pixmap, QRect(0, top, left, size.height() - bottom - top));
0
369 QRect(0, top, left, size.height() - bottom - top));
never executed: painter->drawPixmap(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), pixmap, QRect(0, top, left, size.height() - bottom - top));
0
370 -
371 //center -
372 painter->drawPixmap(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left,
never executed (the execution status of this line is deduced): painter->drawPixmap(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left,
-
373 rect.height() - bottom - top), pixmap,
never executed (the execution status of this line is deduced): rect.height() - bottom - top), pixmap,
-
374 QRect(left, top, size.width() -right -left,
never executed (the execution status of this line is deduced): QRect(left, top, size.width() -right -left,
-
375 size.height() - bottom - top));
never executed (the execution status of this line is deduced): size.height() - bottom - top));
-
376 //right -
377 if (right > 0)
never evaluated: right > 0
0
378 painter->drawPixmap(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), pixmap,
never executed: painter->drawPixmap(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), pixmap, QRect(size.width() - right, top, right, size.height() - bottom - top));
0
379 QRect(size.width() - right, top, right, size.height() - bottom - top));
never executed: painter->drawPixmap(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), pixmap, QRect(size.width() - right, top, right, size.height() - bottom - top));
0
380 -
381 //bottom -
382 if (bottom > 0) {
never evaluated: bottom > 0
0
383 painter->drawPixmap(QRect(rect.left() +left, rect.top() + rect.height() - bottom,
never executed (the execution status of this line is deduced): painter->drawPixmap(QRect(rect.left() +left, rect.top() + rect.height() - bottom,
-
384 rect.width() - right - left, bottom), pixmap,
never executed (the execution status of this line is deduced): rect.width() - right - left, bottom), pixmap,
-
385 QRect(left, size.height() - bottom,
never executed (the execution status of this line is deduced): QRect(left, size.height() - bottom,
-
386 size.width() - right - left, bottom));
never executed (the execution status of this line is deduced): size.width() - right - left, bottom));
-
387 //bottom-left -
388 if (left > 0)
never evaluated: left > 0
0
389 painter->drawPixmap(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), pixmap,
never executed: painter->drawPixmap(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), pixmap, QRect(0, size.height() - bottom, left, bottom));
0
390 QRect(0, size.height() - bottom, left, bottom));
never executed: painter->drawPixmap(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), pixmap, QRect(0, size.height() - bottom, left, bottom));
0
391 -
392 //bottom-right -
393 if (right > 0)
never evaluated: right > 0
0
394 painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), pixmap,
never executed: painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), pixmap, QRect(size.width() - right, size.height() - bottom, right, bottom));
0
395 QRect(size.width() - right, size.height() - bottom, right, bottom));
never executed: painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), pixmap, QRect(size.width() - right, size.height() - bottom, right, bottom));
0
396 -
397 }
never executed: }
0
398}
never executed: }
0
399} -
400QT_END_NAMESPACE -
401 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial