styles/qstylehelper.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 <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:6089
3-6089
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:6092
6092
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:283795
283795
86#endif -
87} -
88 -
89#ifndef QT_NO_ACCESSIBILITY -
90bool isInstanceOf(QObject *obj, QAccessible::Role role) -
91{ -
92 bool match = false;
never executed (the execution status of this line is deduced): bool match = false;
-
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 return match;
never executed: return match;
0
97} -
98 -
99// Searches for an ancestor of a particular accessible role -
100bool hasAncestor(QObject *obj, QAccessible::Role role) -
101{ -
102 bool found = false;
never executed (the execution status of this line is deduced): bool found = false;
-
103 QObject *parent = obj ? obj->parent() : 0;
never evaluated: obj
0
104 while (parent && !found) {
never evaluated: parent
never evaluated: !found
0
105 if (isInstanceOf(parent, role))
never evaluated: isInstanceOf(parent, role)
0
106 found = true;
never executed: found = true;
0
107 parent = parent->parent();
never executed (the execution status of this line is deduced): parent = parent->parent();
-
108 }
never executed: }
0
109 return found;
never executed: return found;
0
110} -
111#endif // QT_NO_ACCESSIBILITY -
112 -
113 -
114#ifndef QT_NO_DIAL -
115 -
116int calcBigLineSize(int radius) -
117{ -
118 int bigLineSize = radius / 6;
executed (the execution status of this line is deduced): int bigLineSize = radius / 6;
-
119 if (bigLineSize < 4)
partially evaluated: bigLineSize < 4
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
120 bigLineSize = 4;
never executed: bigLineSize = 4;
0
121 if (bigLineSize > radius / 2)
partially evaluated: bigLineSize > radius / 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
122 bigLineSize = radius / 2;
never executed: bigLineSize = radius / 2;
0
123 return bigLineSize;
executed: return bigLineSize;
Execution Count:13
13
124} -
125 -
126static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset) -
127{ -
128 const int width = dial->rect.width();
executed (the execution status of this line is deduced): const int width = dial->rect.width();
-
129 const int height = dial->rect.height();
executed (the execution status of this line is deduced): const int height = dial->rect.height();
-
130 const int r = qMin(width, height) / 2;
executed (the execution status of this line is deduced): const int r = qMin(width, height) / 2;
-
131 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
132 qreal a = 0;
executed (the execution status of this line is deduced): qreal a = 0;
-
133 if (dial->maximum == dial->minimum)
partially evaluated: dial->maximum == dial->minimum
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
134 a = Q_PI / 2;
never executed: a = Q_PI / 2;
0
135 else if (dial->dialWrapping)
partially evaluated: dial->dialWrapping
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
136 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
137 / (dial->maximum - dial->minimum);
never executed: a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI / (dial->maximum - dial->minimum);
0
138 else -
139 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
140 / (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
141 qreal xc = width / 2.0;
executed (the execution status of this line is deduced): qreal xc = width / 2.0;
-
142 qreal yc = height / 2.0;
executed (the execution status of this line is deduced): qreal yc = height / 2.0;
-
143 qreal len = r - QStyleHelper::calcBigLineSize(r) - 3;
executed (the execution status of this line is deduced): qreal len = r - QStyleHelper::calcBigLineSize(r) - 3;
-
144 qreal back = offset * len;
executed (the execution status of this line is deduced): qreal back = offset * len;
-
145 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)));
-
146 return pos;
executed: return pos;
Execution Count:3
3
147} -
148 -
149qreal angle(const QPointF &p1, const QPointF &p2) -
150{ -
151 static const qreal rad_factor = 180 / Q_PI; -
152 qreal _angle = 0;
executed (the execution status of this line is deduced): qreal _angle = 0;
-
153 -
154 if (p1.x() == p2.x()) {
partially evaluated: p1.x() == p2.x()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
155 if (p1.y() < p2.y())
never evaluated: p1.y() < p2.y()
0
156 _angle = 270;
never executed: _angle = 270;
0
157 else -
158 _angle = 90;
never executed: _angle = 90;
0
159 } else { -
160 qreal x1, x2, y1, y2;
executed (the execution status of this line is deduced): qreal x1, x2, y1, y2;
-
161 -
162 if (p1.x() <= p2.x()) {
evaluated: p1.x() <= p2.x()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
163 x1 = p1.x(); y1 = p1.y();
executed (the execution status of this line is deduced): x1 = p1.x(); y1 = p1.y();
-
164 x2 = p2.x(); y2 = p2.y();
executed (the execution status of this line is deduced): x2 = p2.x(); y2 = p2.y();
-
165 } else {
executed: }
Execution Count:3
3
166 x2 = p1.x(); y2 = p1.y();
executed (the execution status of this line is deduced): x2 = p1.x(); y2 = p1.y();
-
167 x1 = p2.x(); y1 = p2.y();
executed (the execution status of this line is deduced): x1 = p2.x(); y1 = p2.y();
-
168 }
executed: }
Execution Count:3
3
169 -
170 qreal m = -(y2 - y1) / (x2 - x1);
executed (the execution status of this line is deduced): qreal m = -(y2 - y1) / (x2 - x1);
-
171 _angle = qAtan(m) * rad_factor;
executed (the execution status of this line is deduced): _angle = qAtan(m) * rad_factor;
-
172 -
173 if (p1.x() < p2.x())
evaluated: p1.x() < p2.x()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
174 _angle = 180 - _angle;
executed: _angle = 180 - _angle;
Execution Count:3
3
175 else -
176 _angle = -_angle;
executed: _angle = -_angle;
Execution Count:3
3
177 } -
178 return _angle;
executed: return _angle;
Execution Count:6
6
179} -
180 -
181QPolygonF calcLines(const QStyleOptionSlider *dial) -
182{ -
183 QPolygonF poly;
executed (the execution status of this line is deduced): QPolygonF poly;
-
184 int width = dial->rect.width();
executed (the execution status of this line is deduced): int width = dial->rect.width();
-
185 int height = dial->rect.height();
executed (the execution status of this line is deduced): int height = dial->rect.height();
-
186 qreal r = qMin(width, height) / 2;
executed (the execution status of this line is deduced): qreal r = qMin(width, height) / 2;
-
187 int bigLineSize = calcBigLineSize(int(r));
executed (the execution status of this line is deduced): int bigLineSize = calcBigLineSize(int(r));
-
188 -
189 qreal xc = width / 2 + 0.5;
executed (the execution status of this line is deduced): qreal xc = width / 2 + 0.5;
-
190 qreal yc = height / 2 + 0.5;
executed (the execution status of this line is deduced): qreal yc = height / 2 + 0.5;
-
191 const int ns = dial->tickInterval;
executed (the execution status of this line is deduced): const int ns = dial->tickInterval;
-
192 if (!ns) // Invalid values may be set by Qt Designer.
partially evaluated: !ns
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
193 return poly;
never executed: return poly;
0
194 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;
-
195 if (notches <= 0)
partially evaluated: notches <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
196 return poly;
never executed: return poly;
0
197 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
198 int maximum = dial->minimum + 1000;
never executed (the execution status of this line is deduced): int maximum = dial->minimum + 1000;
-
199 notches = (maximum + ns - 1 - dial->minimum) / ns;
never executed (the execution status of this line is deduced): notches = (maximum + ns - 1 - dial->minimum) / ns;
-
200 }
never executed: }
0
201 -
202 poly.resize(2 + 2 * notches);
executed (the execution status of this line is deduced): poly.resize(2 + 2 * notches);
-
203 int smallLineSize = bigLineSize / 2;
executed (the execution status of this line is deduced): int smallLineSize = bigLineSize / 2;
-
204 for (int i = 0; i <= notches; ++i) {
evaluated: i <= notches
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:4
4-20
205 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
206 : (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;
-
207 qreal s = qSin(angle);
executed (the execution status of this line is deduced): qreal s = qSin(angle);
-
208 qreal c = qCos(angle);
executed (the execution status of this line is deduced): qreal c = qCos(angle);
-
209 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
210 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,
-
211 yc - (r - bigLineSize) * s);
executed (the execution status of this line is deduced): yc - (r - bigLineSize) * s);
-
212 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);
-
213 } else {
executed: }
Execution Count:20
20
214 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,
-
215 yc - (r - 1 - smallLineSize) * s);
never executed (the execution status of this line is deduced): yc - (r - 1 - smallLineSize) * s);
-
216 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);
-
217 }
never executed: }
0
218 } -
219 return poly;
executed: return poly;
Execution Count:4
4
220} -
221 -
222// This will draw a nice and shiny QDial for us. We don't want -
223// all the shinyness in QWindowsStyle, hence we place it here -
224 -
225void drawDial(const QStyleOptionSlider *option, QPainter *painter) -
226{ -
227 QPalette pal = option->palette;
executed (the execution status of this line is deduced): QPalette pal = option->palette;
-
228 QColor buttonColor = pal.button().color();
executed (the execution status of this line is deduced): QColor buttonColor = pal.button().color();
-
229 const int width = option->rect.width();
executed (the execution status of this line is deduced): const int width = option->rect.width();
-
230 const int height = option->rect.height();
executed (the execution status of this line is deduced): const int height = option->rect.height();
-
231 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;
-
232 qreal r = qMin(width, height) / 2;
executed (the execution status of this line is deduced): qreal r = qMin(width, height) / 2;
-
233 r -= r/50;
executed (the execution status of this line is deduced): r -= r/50;
-
234 const qreal penSize = r/20.0;
executed (the execution status of this line is deduced): const qreal penSize = r/20.0;
-
235 -
236 painter->save();
executed (the execution status of this line is deduced): painter->save();
-
237 painter->setRenderHint(QPainter::Antialiasing);
executed (the execution status of this line is deduced): painter->setRenderHint(QPainter::Antialiasing);
-
238 -
239 // Draw notches -
240 if (option->subControls & QStyle::SC_DialTickmarks) {
partially evaluated: option->subControls & QStyle::SC_DialTickmarks
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
241 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));
-
242 painter->drawLines(QStyleHelper::calcLines(option));
executed (the execution status of this line is deduced): painter->drawLines(QStyleHelper::calcLines(option));
-
243 }
executed: }
Execution Count:1
1
244 -
245 // Cache dial background -
246 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
247 p->setRenderHint(QPainter::Antialiasing);
executed (the execution status of this line is deduced): p->setRenderHint(QPainter::Antialiasing);
-
248 -
249 const qreal d_ = r / 6;
executed (the execution status of this line is deduced): const qreal d_ = r / 6;
-
250 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;
-
251 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;
-
252 -
253 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,
-
254 int(r * 2 - 2 * d_ - 2),
executed (the execution status of this line is deduced): int(r * 2 - 2 * d_ - 2),
-
255 int(r * 2 - 2 * d_ - 2));
executed (the execution status of this line is deduced): int(r * 2 - 2 * d_ - 2));
-
256 buttonColor.setHsv(buttonColor .hue(),
executed (the execution status of this line is deduced): buttonColor.setHsv(buttonColor .hue(),
-
257 qMin(140, buttonColor .saturation()),
executed (the execution status of this line is deduced): qMin(140, buttonColor .saturation()),
-
258 qMax(180, buttonColor.value()));
executed (the execution status of this line is deduced): qMax(180, buttonColor.value()));
-
259 QColor shadowColor(0, 0, 0, 20);
executed (the execution status of this line is deduced): QColor shadowColor(0, 0, 0, 20);
-
260 -
261 if (enabled) {
partially evaluated: enabled
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
262 // Drop shadow -
263 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);
-
264 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,
-
265 2*shadowSize, 2*shadowSize);
executed (the execution status of this line is deduced): 2*shadowSize, 2*shadowSize);
-
266 QRadialGradient shadowGradient(shadowRect.center().x(),
executed (the execution status of this line is deduced): QRadialGradient shadowGradient(shadowRect.center().x(),
-
267 shadowRect.center().y(), shadowRect.width()/2.0,
executed (the execution status of this line is deduced): shadowRect.center().y(), shadowRect.width()/2.0,
-
268 shadowRect.center().x(), shadowRect.center().y());
executed (the execution status of this line is deduced): shadowRect.center().x(), shadowRect.center().y());
-
269 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));
-
270 shadowGradient.setColorAt(qreal(1.0), Qt::transparent);
executed (the execution status of this line is deduced): shadowGradient.setColorAt(qreal(1.0), Qt::transparent);
-
271 p->setBrush(shadowGradient);
executed (the execution status of this line is deduced): p->setBrush(shadowGradient);
-
272 p->setPen(Qt::NoPen);
executed (the execution status of this line is deduced): p->setPen(Qt::NoPen);
-
273 p->translate(shadowSize, shadowSize);
executed (the execution status of this line is deduced): p->translate(shadowSize, shadowSize);
-
274 p->drawEllipse(shadowRect);
executed (the execution status of this line is deduced): p->drawEllipse(shadowRect);
-
275 p->translate(-shadowSize, -shadowSize);
executed (the execution status of this line is deduced): p->translate(-shadowSize, -shadowSize);
-
276 -
277 // Main gradient -
278 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,
-
279 br.width()*1.3, br.center().x(),
executed (the execution status of this line is deduced): br.width()*1.3, br.center().x(),
-
280 br.center().y() - br.height()/2);
executed (the execution status of this line is deduced): br.center().y() - br.height()/2);
-
281 gradient.setColorAt(0, buttonColor.lighter(110));
executed (the execution status of this line is deduced): gradient.setColorAt(0, buttonColor.lighter(110));
-
282 gradient.setColorAt(qreal(0.5), buttonColor);
executed (the execution status of this line is deduced): gradient.setColorAt(qreal(0.5), buttonColor);
-
283 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));
-
284 gradient.setColorAt(1, buttonColor.darker(115));
executed (the execution status of this line is deduced): gradient.setColorAt(1, buttonColor.darker(115));
-
285 p->setBrush(gradient);
executed (the execution status of this line is deduced): p->setBrush(gradient);
-
286 } else {
executed: }
Execution Count:1
1
287 p->setBrush(Qt::NoBrush);
never executed (the execution status of this line is deduced): p->setBrush(Qt::NoBrush);
-
288 }
never executed: }
0
289 -
290 p->setPen(QPen(buttonColor.darker(280)));
executed (the execution status of this line is deduced): p->setPen(QPen(buttonColor.darker(280)));
-
291 p->drawEllipse(br);
executed (the execution status of this line is deduced): p->drawEllipse(br);
-
292 p->setBrush(Qt::NoBrush);
executed (the execution status of this line is deduced): p->setBrush(Qt::NoBrush);
-
293 p->setPen(buttonColor.lighter(110));
executed (the execution status of this line is deduced): p->setPen(buttonColor.lighter(110));
-
294 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));
-
295 -
296 if (option->state & QStyle::State_HasFocus) {
partially evaluated: option->state & QStyle::State_HasFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
297 QColor highlight = pal.highlight().color();
never executed (the execution status of this line is deduced): QColor highlight = pal.highlight().color();
-
298 highlight.setHsv(highlight.hue(),
never executed (the execution status of this line is deduced): highlight.setHsv(highlight.hue(),
-
299 qMin(160, highlight.saturation()),
never executed (the execution status of this line is deduced): qMin(160, highlight.saturation()),
-
300 qMax(230, highlight.value()));
never executed (the execution status of this line is deduced): qMax(230, highlight.value()));
-
301 highlight.setAlpha(127);
never executed (the execution status of this line is deduced): highlight.setAlpha(127);
-
302 p->setPen(QPen(highlight, 2.0));
never executed (the execution status of this line is deduced): p->setPen(QPen(highlight, 2.0));
-
303 p->setBrush(Qt::NoBrush);
never executed (the execution status of this line is deduced): p->setBrush(Qt::NoBrush);
-
304 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));
-
305 }
never executed: }
0
306 -
307 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
308 -
309 QPointF dp = calcRadialPos(option, qreal(0.70));
executed (the execution status of this line is deduced): QPointF dp = calcRadialPos(option, qreal(0.70));
-
310 buttonColor = buttonColor.lighter(104);
executed (the execution status of this line is deduced): buttonColor = buttonColor.lighter(104);
-
311 buttonColor.setAlphaF(qreal(0.8));
executed (the execution status of this line is deduced): buttonColor.setAlphaF(qreal(0.8));
-
312 const qreal ds = r/qreal(7.0);
executed (the execution status of this line is deduced): const qreal ds = r/qreal(7.0);
-
313 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);
-
314 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,
-
315 dialRect.center().y() + dialRect.width(),
executed (the execution status of this line is deduced): dialRect.center().y() + dialRect.width(),
-
316 dialRect.width()*2,
executed (the execution status of this line is deduced): dialRect.width()*2,
-
317 dialRect.center().x(), dialRect.center().y());
executed (the execution status of this line is deduced): dialRect.center().x(), dialRect.center().y());
-
318 dialGradient.setColorAt(1, buttonColor.darker(140));
executed (the execution status of this line is deduced): dialGradient.setColorAt(1, buttonColor.darker(140));
-
319 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));
-
320 dialGradient.setColorAt(0, buttonColor.darker(110));
executed (the execution status of this line is deduced): dialGradient.setColorAt(0, buttonColor.darker(110));
-
321 if (penSize > 3.0) {
partially evaluated: penSize > 3.0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
322 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));
-
323 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)));
-
324 }
executed: }
Execution Count:1
1
325 -
326 painter->setBrush(dialGradient);
executed (the execution status of this line is deduced): painter->setBrush(dialGradient);
-
327 painter->setPen(QColor(255, 255, 255, 150));
executed (the execution status of this line is deduced): painter->setPen(QColor(255, 255, 255, 150));
-
328 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));
-
329 painter->setPen(QColor(0, 0, 0, 80));
executed (the execution status of this line is deduced): painter->setPen(QColor(0, 0, 0, 80));
-
330 painter->drawEllipse(dialRect);
executed (the execution status of this line is deduced): painter->drawEllipse(dialRect);
-
331 painter->restore();
executed (the execution status of this line is deduced): painter->restore();
-
332}
executed: }
Execution Count:1
1
333#endif //QT_NO_DIAL -
334 -
335void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, -
336 int left, int top, int right, -
337 int bottom) -
338{ -
339 QSize size = pixmap.size();
never executed (the execution status of this line is deduced): QSize size = pixmap.size();
-
340 //painter->setRenderHint(QPainter::SmoothPixmapTransform); -
341 -
342 //top -
343 if (top > 0) {
never evaluated: top > 0
0
344 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,
-
345 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));
-
346 -
347 //top-left -
348 if(left > 0)
never evaluated: left > 0
0
349 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
350 QRect(0, 0, left, top));
never executed: painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap, QRect(0, 0, left, top));
0
351 -
352 //top-right -
353 if (right > 0)
never evaluated: right > 0
0
354 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
355 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
356 }
never executed: }
0
357 -
358 //left -
359 if (left > 0)
never evaluated: left > 0
0
360 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
361 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
362 -
363 //center -
364 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,
-
365 rect.height() - bottom - top), pixmap,
never executed (the execution status of this line is deduced): rect.height() - bottom - top), pixmap,
-
366 QRect(left, top, size.width() -right -left,
never executed (the execution status of this line is deduced): QRect(left, top, size.width() -right -left,
-
367 size.height() - bottom - top));
never executed (the execution status of this line is deduced): size.height() - bottom - top));
-
368 //right -
369 if (right > 0)
never evaluated: right > 0
0
370 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
371 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
372 -
373 //bottom -
374 if (bottom > 0) {
never evaluated: bottom > 0
0
375 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,
-
376 rect.width() - right - left, bottom), pixmap,
never executed (the execution status of this line is deduced): rect.width() - right - left, bottom), pixmap,
-
377 QRect(left, size.height() - bottom,
never executed (the execution status of this line is deduced): QRect(left, size.height() - bottom,
-
378 size.width() - right - left, bottom));
never executed (the execution status of this line is deduced): size.width() - right - left, bottom));
-
379 //bottom-left -
380 if (left > 0)
never evaluated: left > 0
0
381 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
382 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
383 -
384 //bottom-right -
385 if (right > 0)
never evaluated: right > 0
0
386 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
387 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
388 -
389 }
never executed: }
0
390}
never executed: }
0
391} -
392QT_END_NAMESPACE -
393 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial