Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | using namespace QStyleHelper; | - |
8 | | - |
9 | enum Direction { | - |
10 | TopDown, | - |
11 | FromLeft, | - |
12 | BottomUp, | - |
13 | FromRight | - |
14 | }; | - |
15 | | - |
16 | | - |
17 | static const int windowsItemFrame = 2; | - |
18 | static const int windowsItemHMargin = 3; | - |
19 | static const int windowsItemVMargin = 8; | - |
20 | static const int windowsRightBorder = 15; | - |
21 | | - |
22 | static const int groupBoxBottomMargin = 0; | - |
23 | static const int groupBoxTopMargin = 3; | - |
24 | | - |
25 | | - |
26 | | - |
27 | static const char * const dock_widget_close_xpm[] = { | - |
28 | "11 13 7 1", | - |
29 | " c None", | - |
30 | ". c #D5CFCB", | - |
31 | "+ c #8F8B88", | - |
32 | "@ c #6C6A67", | - |
33 | "# c #ABA6A3", | - |
34 | "$ c #B5B0AC", | - |
35 | "% c #A4A09D", | - |
36 | " ", | - |
37 | " +@@@@@@@+ ", | - |
38 | "+# #+", | - |
39 | "@ $@ @$ @", | - |
40 | "@ @@@ @@@ @", | - |
41 | "@ @@@@@ @", | - |
42 | "@ @@@ @", | - |
43 | "@ @@@@@ @", | - |
44 | "@ @@@ @@@ @", | - |
45 | "@ $@ @$ @", | - |
46 | "+% #+", | - |
47 | " +@@@@@@@+ ", | - |
48 | " "}; | - |
49 | | - |
50 | static const char * const dock_widget_restore_xpm[] = { | - |
51 | "11 13 7 1", | - |
52 | " c None", | - |
53 | ". c #D5CFCB", | - |
54 | "+ c #8F8B88", | - |
55 | "@ c #6C6A67", | - |
56 | "# c #ABA6A3", | - |
57 | "$ c #B5B0AC", | - |
58 | "% c #A4A09D", | - |
59 | " ", | - |
60 | " +@@@@@@@+ ", | - |
61 | "+# #+", | - |
62 | "@ #@@@# @", | - |
63 | "@ @ @ @", | - |
64 | "@ #@@@# @ @", | - |
65 | "@ @ @ @ @", | - |
66 | "@ @ @@@ @", | - |
67 | "@ @ @ @", | - |
68 | "@ #@@@# @", | - |
69 | "+% #+", | - |
70 | " +@@@@@@@+ ", | - |
71 | " "}; | - |
72 | | - |
73 | static const char * const workspace_minimize[] = { | - |
74 | "11 13 7 1", | - |
75 | " c None", | - |
76 | ". c #D5CFCB", | - |
77 | "+ c #8F8B88", | - |
78 | "@ c #6C6A67", | - |
79 | "# c #ABA6A3", | - |
80 | "$ c #B5B0AC", | - |
81 | "% c #A4A09D", | - |
82 | " ", | - |
83 | " +@@@@@@@+ ", | - |
84 | "+# #+", | - |
85 | "@ @", | - |
86 | "@ @", | - |
87 | "@ @", | - |
88 | "@ @@@@@@@ @", | - |
89 | "@ @@@@@@@ @", | - |
90 | "@ @", | - |
91 | "@ @", | - |
92 | "+% #+", | - |
93 | " +@@@@@@@+ ", | - |
94 | " "}; | - |
95 | | - |
96 | | - |
97 | static const char * const qt_titlebar_context_help[] = { | - |
98 | "10 10 3 1", | - |
99 | " c None", | - |
100 | "# c #000000", | - |
101 | "+ c #444444", | - |
102 | " +####+ ", | - |
103 | " ### ### ", | - |
104 | " ## ## ", | - |
105 | " +##+ ", | - |
106 | " +## ", | - |
107 | " ## ", | - |
108 | " ## ", | - |
109 | " ", | - |
110 | " ## ", | - |
111 | " ## "}; | - |
112 | | - |
113 | | - |
114 | static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) | - |
115 | { | - |
116 | const int maxFactor = 100; | - |
117 | QColor tmp = colorA; | - |
118 | tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor); | - |
119 | tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor); | - |
120 | tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor); | - |
121 | return tmp; executed: return tmp; Execution Count:309 | 309 |
122 | } | - |
123 | | - |
124 | static QPixmap colorizedImage(const QString &fileName, const QColor &color, int rotation = 0) { | - |
125 | | - |
126 | QString pixmapName = QLatin1String("$qt_ia-") % fileName % HexString<uint>(color.rgba()) % QString::number(rotation); | - |
127 | QPixmap pixmap; | - |
128 | if (!QPixmapCache::find(pixmapName, pixmap)) { evaluated: !QPixmapCache::find(pixmapName, pixmap) yes Evaluation Count:10 | yes Evaluation Count:290 |
| 10-290 |
129 | QImage image(fileName); | - |
130 | | - |
131 | if (image.format() != QImage::Format_ARGB32_Premultiplied) partially evaluated: image.format() != QImage::Format_ARGB32_Premultiplied yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
132 | image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied); executed: image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied); Execution Count:10 | 10 |
133 | | - |
134 | int width = image.width(); | - |
135 | int height = image.height(); | - |
136 | int source = color.rgba(); | - |
137 | | - |
138 | unsigned char sourceRed = qRed(source); | - |
139 | unsigned char sourceGreen = qGreen(source); | - |
140 | unsigned char sourceBlue = qBlue(source); | - |
141 | | - |
142 | for (int y = 0; y < height; ++y) evaluated: y < height yes Evaluation Count:90 | yes Evaluation Count:10 |
| 10-90 |
143 | { | - |
144 | QRgb *data = (QRgb*) image.scanLine(y); | - |
145 | for (int x = 0 ; x < width ; x++) { evaluated: x < width yes Evaluation Count:1350 | yes Evaluation Count:90 |
| 90-1350 |
146 | QRgb col = data[x]; | - |
147 | unsigned int colorDiff = (qBlue(col) - qRed(col)); | - |
148 | unsigned char gray = qGreen(col); | - |
149 | unsigned char red = gray + qt_div_255(sourceRed * colorDiff); | - |
150 | unsigned char green = gray + qt_div_255(sourceGreen * colorDiff); | - |
151 | unsigned char blue = gray + qt_div_255(sourceBlue * colorDiff); | - |
152 | unsigned char alpha = qt_div_255(qAlpha(col) * qAlpha(source)); | - |
153 | data[x] = qRgba(red, green, blue, alpha); | - |
154 | } executed: } Execution Count:1350 | 1350 |
155 | } executed: } Execution Count:90 | 90 |
156 | if (rotation != 0) { evaluated: rotation != 0 yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
157 | QTransform transform; | - |
158 | transform.translate(-image.width()/2, -image.height()/2); | - |
159 | transform.rotate(rotation); | - |
160 | transform.translate(image.width()/2, image.height()/2); | - |
161 | image = image.transformed(transform); | - |
162 | } executed: } Execution Count:6 | 6 |
163 | | - |
164 | pixmap = QPixmap::fromImage(image); | - |
165 | QPixmapCache::insert(pixmapName, pixmap); | - |
166 | } executed: } Execution Count:10 | 10 |
167 | return pixmap; executed: return pixmap; Execution Count:300 | 300 |
168 | } | - |
169 | | - |
170 | | - |
171 | static QLinearGradient qt_fusion_gradient(const QRect &rect, const QBrush &baseColor, Direction direction = TopDown) | - |
172 | { | - |
173 | int x = rect.center().x(); | - |
174 | int y = rect.center().y(); | - |
175 | QLinearGradient gradient; | - |
176 | switch (direction) { | - |
177 | case FromLeft: | - |
178 | gradient = QLinearGradient(rect.left(), y, rect.right(), y); | - |
179 | break; | 0 |
180 | case FromRight: | - |
181 | gradient = QLinearGradient(rect.right(), y, rect.left(), y); | - |
182 | break; | 0 |
183 | case BottomUp: | - |
184 | gradient = QLinearGradient(x, rect.bottom(), x, rect.top()); | - |
185 | break; | 0 |
186 | case TopDown: | - |
187 | default: | - |
188 | gradient = QLinearGradient(x, rect.top(), x, rect.bottom()); | - |
189 | break; executed: break; Execution Count:16 | 16 |
190 | } | - |
191 | if (baseColor.gradient()) partially evaluated: baseColor.gradient() no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
192 | gradient.setStops(baseColor.gradient()->stops()); never executed: gradient.setStops(baseColor.gradient()->stops()); | 0 |
193 | else { | - |
194 | QColor gradientStartColor = baseColor.color().lighter(124); | - |
195 | QColor gradientStopColor = baseColor.color().lighter(102); | - |
196 | gradient.setColorAt(0, gradientStartColor); | - |
197 | gradient.setColorAt(1, gradientStopColor); | - |
198 | | - |
199 | | - |
200 | | - |
201 | | - |
202 | | - |
203 | } executed: } Execution Count:16 | 16 |
204 | return gradient; executed: return gradient; Execution Count:16 | 16 |
205 | } | - |
206 | | - |
207 | | - |
208 | static void qt_fusion_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken) | - |
209 | { | - |
210 | QColor dark; | - |
211 | dark.setHsv(option->palette.button().color().hue(), | - |
212 | qMin(255, (int)(option->palette.button().color().saturation())), | - |
213 | qMin(255, (int)(option->palette.button().color().value()*0.7))); | - |
214 | | - |
215 | QColor highlight = option->palette.highlight().color(); | - |
216 | | - |
217 | bool active = (option->titleBarState & QStyle::State_Active); | - |
218 | QColor titleBarHighlight(255, 255, 255, 60); | - |
219 | | - |
220 | if (sunken) | 0 |
221 | painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120)); never executed: painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120)); | 0 |
222 | else if (hover) | 0 |
223 | painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20)); never executed: painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20)); | 0 |
224 | | - |
225 | QColor mdiButtonGradientStartColor; | - |
226 | QColor mdiButtonGradientStopColor; | - |
227 | | - |
228 | mdiButtonGradientStartColor = QColor(0, 0, 0, 40); | - |
229 | mdiButtonGradientStopColor = QColor(255, 255, 255, 60); | - |
230 | | - |
231 | if (sunken) | 0 |
232 | titleBarHighlight = highlight.darker(130); never executed: titleBarHighlight = highlight.darker(130); | 0 |
233 | | - |
234 | QLinearGradient gradient(tmp.center().x(), tmp.top(), tmp.center().x(), tmp.bottom()); | - |
235 | gradient.setColorAt(0, mdiButtonGradientStartColor); | - |
236 | gradient.setColorAt(1, mdiButtonGradientStopColor); | - |
237 | QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110)); | - |
238 | | - |
239 | painter->setPen(QPen(mdiButtonBorderColor)); | - |
240 | const QLine lines[4] = { | - |
241 | QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()), | - |
242 | QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()), | - |
243 | QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2), | - |
244 | QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2) | - |
245 | }; | - |
246 | painter->drawLines(lines, 4); | - |
247 | const QPoint points[4] = { | - |
248 | QPoint(tmp.left() + 1, tmp.top() + 1), | - |
249 | QPoint(tmp.right() - 1, tmp.top() + 1), | - |
250 | QPoint(tmp.left() + 1, tmp.bottom() - 1), | - |
251 | QPoint(tmp.right() - 1, tmp.bottom() - 1) | - |
252 | }; | - |
253 | painter->drawPoints(points, 4); | - |
254 | | - |
255 | painter->setPen(titleBarHighlight); | - |
256 | painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1); | - |
257 | painter->drawLine(tmp.left() + 1, tmp.top() + 2, tmp.left() + 1, tmp.bottom() - 2); | - |
258 | | - |
259 | painter->setPen(QPen(gradient, 1)); | - |
260 | painter->drawLine(tmp.right() + 1, tmp.top() + 2, tmp.right() + 1, tmp.bottom() - 2); | - |
261 | painter->drawPoint(tmp.right() , tmp.top() + 1); | - |
262 | | - |
263 | painter->drawLine(tmp.left() + 2, tmp.bottom() + 1, tmp.right() - 2, tmp.bottom() + 1); | - |
264 | painter->drawPoint(tmp.left() + 1, tmp.bottom()); | - |
265 | painter->drawPoint(tmp.right() - 1, tmp.bottom()); | - |
266 | painter->drawPoint(tmp.right() , tmp.bottom() - 1); | - |
267 | } | 0 |
268 | | - |
269 | | - |
270 | | - |
271 | | - |
272 | QFusionStylePrivate::QFusionStylePrivate() | - |
273 | { | - |
274 | animationFps = 60; | - |
275 | } executed: } Execution Count:198 | 198 |
276 | QFusionStyle::QFusionStyle() : QCommonStyle(*new QFusionStylePrivate) | - |
277 | { | - |
278 | setObjectName(QLatin1String("Fusion")); | - |
279 | } executed: } Execution Count:198 | 198 |
280 | | - |
281 | | - |
282 | | - |
283 | | - |
284 | | - |
285 | | - |
286 | QFusionStyle::QFusionStyle(QFusionStylePrivate &dd) : QCommonStyle(dd) | - |
287 | { | - |
288 | } | 0 |
289 | | - |
290 | | - |
291 | | - |
292 | | - |
293 | QFusionStyle::~QFusionStyle() | - |
294 | { | - |
295 | } | - |
296 | void QFusionStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, | - |
297 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - |
298 | { | - |
299 | if (text.isEmpty()) partially evaluated: text.isEmpty() no Evaluation Count:0 | yes Evaluation Count:34 |
| 0-34 |
300 | return; | 0 |
301 | | - |
302 | QPen savedPen = painter->pen(); | - |
303 | if (textRole != QPalette::NoRole) { partially evaluated: textRole != QPalette::NoRole yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
304 | painter->setPen(QPen(pal.brush(textRole), savedPen.widthF())); | - |
305 | } executed: } Execution Count:34 | 34 |
306 | if (!enabled) { partially evaluated: !enabled no Evaluation Count:0 | yes Evaluation Count:34 |
| 0-34 |
307 | QPen pen = painter->pen(); | - |
308 | painter->setPen(pen); | - |
309 | } | 0 |
310 | painter->drawText(rect, alignment, text); | - |
311 | painter->setPen(savedPen); | - |
312 | } executed: } Execution Count:34 | 34 |
313 | | - |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | void QFusionStyle::drawPrimitive(PrimitiveElement elem, | - |
319 | const QStyleOption *option, | - |
320 | QPainter *painter, const QWidget *widget) const | - |
321 | { | - |
322 | qt_noop(); | - |
323 | const QFusionStylePrivate * const d = d_func(); | - |
324 | | - |
325 | QRect rect = option->rect; | - |
326 | int state = option->state; | - |
327 | | - |
328 | QColor outline = d->outline(option->palette); | - |
329 | QColor highlightedOutline = d->highlightedOutline(option->palette); | - |
330 | | - |
331 | QColor tabFrameColor = d->tabFrameColor(option->palette); | - |
332 | | - |
333 | switch (elem) { | - |
334 | | - |
335 | | - |
336 | case PE_FrameGroupBox: | - |
337 | { | - |
338 | QPixmap pixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png")); | - |
339 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - |
340 | QRect frame = option->rect.adjusted(0, topMargin, 0, 0); | - |
341 | qDrawBorderPixmap(painter, frame, QMargins(6, 6, 6, 6), pixmap); | - |
342 | break; executed: break; Execution Count:1 | 1 |
343 | } | - |
344 | case PE_IndicatorBranch: { | - |
345 | if (!(option->state & State_Children)) never evaluated: !(option->state & State_Children) | 0 |
346 | break; | 0 |
347 | if (option->state & State_Open) never evaluated: option->state & State_Open | 0 |
348 | drawPrimitive(PE_IndicatorArrowDown, option, painter, widget); never executed: drawPrimitive(PE_IndicatorArrowDown, option, painter, widget); | 0 |
349 | else | - |
350 | drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); never executed: drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); | 0 |
351 | break; | 0 |
352 | } | - |
353 | case PE_FrameTabBarBase: | - |
354 | if (const QStyleOptionTabBarBase *tbb | 0 |
355 | = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) { never evaluated: const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(option) | 0 |
356 | painter->save(); | - |
357 | painter->setPen(QPen(outline.lighter(110))); | - |
358 | switch (tbb->shape) { | - |
359 | case QTabBar::RoundedNorth: { | - |
360 | QRegion region(tbb->rect); | - |
361 | region -= tbb->selectedTabRect; | - |
362 | painter->drawLine(tbb->rect.topLeft(), tbb->rect.topRight()); | - |
363 | painter->setClipRegion(region); | - |
364 | painter->setPen(option->palette.light().color()); | - |
365 | painter->drawLine(tbb->rect.topLeft() + QPoint(0, 1), tbb->rect.topRight() + QPoint(0, 1)); | - |
366 | } | - |
367 | break; | 0 |
368 | case QTabBar::RoundedWest: | - |
369 | painter->drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom()); | - |
370 | break; | 0 |
371 | case QTabBar::RoundedSouth: | - |
372 | painter->drawLine(tbb->rect.left(), tbb->rect.bottom(), | - |
373 | tbb->rect.right(), tbb->rect.bottom()); | - |
374 | break; | 0 |
375 | case QTabBar::RoundedEast: | - |
376 | painter->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight()); | - |
377 | break; | 0 |
378 | case QTabBar::TriangularNorth: | - |
379 | case QTabBar::TriangularEast: | - |
380 | case QTabBar::TriangularWest: | - |
381 | case QTabBar::TriangularSouth: | - |
382 | painter->restore(); | - |
383 | QCommonStyle::drawPrimitive(elem, option, painter, widget); | - |
384 | return; | 0 |
385 | } | - |
386 | painter->restore(); | - |
387 | } | 0 |
388 | return; | 0 |
389 | case PE_PanelScrollAreaCorner: { | - |
390 | painter->save(); | - |
391 | QColor alphaOutline = outline; | - |
392 | alphaOutline.setAlpha(180); | - |
393 | painter->setPen(alphaOutline); | - |
394 | painter->setBrush(option->palette.brush(QPalette::Window)); | - |
395 | painter->drawRect(option->rect); | - |
396 | painter->restore(); | - |
397 | } break; executed: break; Execution Count:144 | 144 |
398 | case PE_IndicatorArrowUp: | - |
399 | case PE_IndicatorArrowDown: | - |
400 | case PE_IndicatorArrowRight: | - |
401 | case PE_IndicatorArrowLeft: | - |
402 | { | - |
403 | if (option->rect.width() <= 1 || option->rect.height() <= 1) partially evaluated: option->rect.width() <= 1 no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: option->rect.height() <= 1 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
404 | break; | 0 |
405 | QColor arrowColor = option->palette.foreground().color(); | - |
406 | QPixmap arrow; | - |
407 | int rotation = 0; | - |
408 | switch (elem) { | - |
409 | case PE_IndicatorArrowDown: | - |
410 | rotation = 180; | - |
411 | break; executed: break; Execution Count:1 | 1 |
412 | case PE_IndicatorArrowRight: | - |
413 | rotation = 90; | - |
414 | break; | 0 |
415 | case PE_IndicatorArrowLeft: | - |
416 | rotation = -90; | - |
417 | break; | 0 |
418 | default: | - |
419 | break; executed: break; Execution Count:1 | 1 |
420 | } | - |
421 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - |
422 | QRect rect = option->rect; | - |
423 | QRect arrowRect; | - |
424 | int imageMax = qMin(arrow.height(), arrow.width()); | - |
425 | int rectMax = qMin(rect.height(), rect.width()); | - |
426 | int size = qMin(imageMax, rectMax); | - |
427 | | - |
428 | arrowRect.setWidth(size); | - |
429 | arrowRect.setHeight(size); | - |
430 | if (arrow.width() > arrow.height()) partially evaluated: arrow.width() > arrow.height() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
431 | arrowRect.setHeight(arrow.height() * size / arrow.width()); executed: arrowRect.setHeight(arrow.height() * size / arrow.width()); Execution Count:2 | 2 |
432 | else | - |
433 | arrowRect.setWidth(arrow.width() * size / arrow.height()); never executed: arrowRect.setWidth(arrow.width() * size / arrow.height()); | 0 |
434 | | - |
435 | arrowRect.moveTopLeft(rect.center() - arrowRect.center()); | - |
436 | painter->save(); | - |
437 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - |
438 | painter->drawPixmap(arrowRect, arrow); | - |
439 | painter->restore(); | - |
440 | } | - |
441 | break; executed: break; Execution Count:2 | 2 |
442 | case PE_IndicatorViewItemCheck: | - |
443 | { | - |
444 | QStyleOptionButton button; | - |
445 | button.QStyleOption::operator=(*option); | - |
446 | button.state &= ~State_MouseOver; | - |
447 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); | - |
448 | } | - |
449 | return; | 0 |
450 | case PE_IndicatorHeaderArrow: | - |
451 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { never evaluated: const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option) | 0 |
452 | QRect r = header->rect; | - |
453 | QPixmap arrow; | - |
454 | QColor arrowColor = header->palette.foreground().color(); | - |
455 | QPoint offset = QPoint(0, -1); | - |
456 | | - |
457 | if (header->sortIndicator & QStyleOptionHeader::SortUp) { never evaluated: header->sortIndicator & QStyleOptionHeader::SortUp | 0 |
458 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor); | - |
459 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { never evaluated: header->sortIndicator & QStyleOptionHeader::SortDown | 0 |
460 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - |
461 | } if (!arrow.isNull()) { never evaluated: !arrow.isNull() | 0 |
462 | r.setSize(QSize(arrow.width()/2, arrow.height()/2)); | - |
463 | r.moveCenter(header->rect.center()); | - |
464 | painter->drawPixmap(r.translated(offset), arrow); | - |
465 | } | 0 |
466 | } | 0 |
467 | break; | 0 |
468 | case PE_IndicatorButtonDropDown: | - |
469 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | - |
470 | break; | 0 |
471 | | - |
472 | case PE_IndicatorToolBarSeparator: | - |
473 | { | - |
474 | QRect rect = option->rect; | - |
475 | const int margin = 6; | - |
476 | if (option->state & State_Horizontal) { never evaluated: option->state & State_Horizontal | 0 |
477 | const int offset = rect.width()/2; | - |
478 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - |
479 | painter->drawLine(rect.bottomLeft().x() + offset, | - |
480 | rect.bottomLeft().y() - margin, | - |
481 | rect.topLeft().x() + offset, | - |
482 | rect.topLeft().y() + margin); | - |
483 | painter->setPen(QPen(option->palette.background().color().lighter(110))); | - |
484 | painter->drawLine(rect.bottomLeft().x() + offset + 1, | - |
485 | rect.bottomLeft().y() - margin, | - |
486 | rect.topLeft().x() + offset + 1, | - |
487 | rect.topLeft().y() + margin); | - |
488 | } else { | 0 |
489 | const int offset = rect.height()/2; | - |
490 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - |
491 | painter->drawLine(rect.topLeft().x() + margin , | - |
492 | rect.topLeft().y() + offset, | - |
493 | rect.topRight().x() - margin, | - |
494 | rect.topRight().y() + offset); | - |
495 | painter->setPen(QPen(option->palette.background().color().lighter(110))); | - |
496 | painter->drawLine(rect.topLeft().x() + margin , | - |
497 | rect.topLeft().y() + offset + 1, | - |
498 | rect.topRight().x() - margin, | - |
499 | rect.topRight().y() + offset + 1); | - |
500 | } | 0 |
501 | } | - |
502 | break; | 0 |
503 | case PE_Frame: { | - |
504 | if (widget && widget->inherits("QComboBoxPrivateContainer")){ partially evaluated: widget yes Evaluation Count:192 | no Evaluation Count:0 |
partially evaluated: widget->inherits("QComboBoxPrivateContainer") no Evaluation Count:0 | yes Evaluation Count:192 |
| 0-192 |
505 | QStyleOption copy = *option; | - |
506 | copy.state |= State_Raised; | - |
507 | proxy()->drawPrimitive(PE_PanelMenu, ©, painter, widget); | - |
508 | break; | 0 |
509 | } | - |
510 | painter->save(); | - |
511 | QPen thePen(outline.lighter(108)); | - |
512 | thePen.setCosmetic(false); | - |
513 | painter->setPen(thePen); | - |
514 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - |
515 | painter->restore(); } | - |
516 | break; executed: break; Execution Count:192 | 192 |
517 | case PE_FrameMenu: | - |
518 | painter->save(); | - |
519 | { | - |
520 | painter->setPen(QPen(outline)); | - |
521 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - |
522 | QColor frameLight = option->palette.background().color().lighter(160); | - |
523 | QColor frameShadow = option->palette.background().color().darker(110); | - |
524 | | - |
525 | | - |
526 | QRect frame = option->rect.adjusted(1, 1, -1, -1); | - |
527 | painter->setPen(frameLight); | - |
528 | painter->drawLine(frame.topLeft(), frame.bottomLeft()); | - |
529 | painter->drawLine(frame.topLeft(), frame.topRight()); | - |
530 | | - |
531 | painter->setPen(frameShadow); | - |
532 | painter->drawLine(frame.topRight(), frame.bottomRight()); | - |
533 | painter->drawLine(frame.bottomLeft(), frame.bottomRight()); | - |
534 | } | - |
535 | painter->restore(); | - |
536 | break; | 0 |
537 | case PE_FrameDockWidget: | - |
538 | | - |
539 | painter->save(); | - |
540 | { | - |
541 | QColor softshadow = option->palette.background().color().darker(120); | - |
542 | | - |
543 | QRect rect= option->rect; | - |
544 | painter->setPen(softshadow); | - |
545 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - |
546 | painter->setPen(QPen(option->palette.light(), 1)); | - |
547 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), QPoint(rect.left() + 1, rect.bottom() - 1)); | - |
548 | painter->setPen(QPen(option->palette.background().color().darker(120))); | - |
549 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), QPoint(rect.right() - 2, rect.bottom() - 1)); | - |
550 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), QPoint(rect.right() - 1, rect.bottom() - 1)); | - |
551 | | - |
552 | } | - |
553 | painter->restore(); | - |
554 | break; | 0 |
555 | case PE_PanelButtonTool: | - |
556 | painter->save(); | - |
557 | if ((option->state & State_Enabled || option->state & State_On) || !(option->state & State_AutoRaise)) { never evaluated: option->state & State_Enabled never evaluated: option->state & State_On never evaluated: !(option->state & State_AutoRaise) | 0 |
558 | if (widget && widget->inherits("QDockWidgetTitleButton")) { never evaluated: widget->inherits("QDockWidgetTitleButton") | 0 |
559 | if (option->state & State_MouseOver) never evaluated: option->state & State_MouseOver | 0 |
560 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); never executed: proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | 0 |
561 | } else { | 0 |
562 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | - |
563 | } | 0 |
564 | } | - |
565 | painter->restore(); | - |
566 | break; | 0 |
567 | case PE_IndicatorDockWidgetResizeHandle: | - |
568 | { | - |
569 | QStyleOption dockWidgetHandle = *option; | - |
570 | bool horizontal = option->state & State_Horizontal; | - |
571 | if (horizontal) never evaluated: horizontal | 0 |
572 | dockWidgetHandle.state &= ~State_Horizontal; never executed: dockWidgetHandle.state &= ~State_Horizontal; | 0 |
573 | else | - |
574 | dockWidgetHandle.state |= State_Horizontal; never executed: dockWidgetHandle.state |= State_Horizontal; | 0 |
575 | proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget); | - |
576 | } | - |
577 | break; | 0 |
578 | case PE_FrameWindow: | - |
579 | painter->save(); | - |
580 | { | - |
581 | QRect rect= option->rect; | - |
582 | painter->setPen(QPen(outline.darker(150))); | - |
583 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - |
584 | painter->setPen(QPen(option->palette.light(), 1)); | - |
585 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - |
586 | QPoint(rect.left() + 1, rect.bottom() - 1)); | - |
587 | painter->setPen(QPen(option->palette.background().color().darker(120))); | - |
588 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), | - |
589 | QPoint(rect.right() - 2, rect.bottom() - 1)); | - |
590 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), | - |
591 | QPoint(rect.right() - 1, rect.bottom() - 1)); | - |
592 | } | - |
593 | painter->restore(); | - |
594 | break; | 0 |
595 | case PE_FrameLineEdit: | - |
596 | { | - |
597 | QRect r = rect; | - |
598 | bool hasFocus = option->state & State_HasFocus; | - |
599 | | - |
600 | painter->save(); | - |
601 | | - |
602 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
603 | | - |
604 | painter->translate(0.5, 0.5); | - |
605 | | - |
606 | | - |
607 | painter->setPen( QPen(hasFocus ? highlightedOutline : outline)); | - |
608 | painter->setBrush(option->palette.base()); | - |
609 | painter->drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - |
610 | | - |
611 | if (hasFocus) { partially evaluated: hasFocus no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
612 | QColor softHighlight = highlightedOutline; | - |
613 | softHighlight.setAlpha(40); | - |
614 | painter->setPen(softHighlight); | - |
615 | painter->drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7); | - |
616 | } | 0 |
617 | | - |
618 | painter->setPen(d->topShadow()); | - |
619 | painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); | - |
620 | | - |
621 | painter->restore(); | - |
622 | | - |
623 | } | - |
624 | break; executed: break; Execution Count:2 | 2 |
625 | case PE_IndicatorCheckBox: | - |
626 | painter->save(); | - |
627 | if (const QStyleOptionButton *checkbox = qstyleoption_cast<const QStyleOptionButton*>(option)) { partially evaluated: const QStyleOptionButton *checkbox = qstyleoption_cast<const QStyleOptionButton*>(option) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
628 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
629 | painter->translate(0.5, 0.5); | - |
630 | rect = rect.adjusted(0, 0, -1, -1); | - |
631 | | - |
632 | QColor pressedColor = mergedColors(option->palette.base().color(), option->palette.foreground().color(), 85); | - |
633 | painter->setBrush(Qt::NoBrush); | - |
634 | | - |
635 | | - |
636 | QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); | - |
637 | gradient.setColorAt(0, (state & State_Sunken) ? pressedColor : option->palette.base().color().darker(115)); | - |
638 | gradient.setColorAt(0.15, (state & State_Sunken) ? pressedColor : option->palette.base().color()); | - |
639 | gradient.setColorAt(1, (state & State_Sunken) ? pressedColor : option->palette.base().color()); | - |
640 | | - |
641 | painter->setBrush((state & State_Sunken) ? QBrush(pressedColor) : gradient); | - |
642 | painter->setPen(QPen(outline.lighter(110))); | - |
643 | | - |
644 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) partially evaluated: option->state & State_HasFocus no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: option->state & State_KeyboardFocusChange | 0-1 |
645 | painter->setPen(QPen(highlightedOutline)); never executed: painter->setPen(QPen(highlightedOutline)); | 0 |
646 | painter->drawRect(rect); | - |
647 | | - |
648 | QColor checkMarkColor = option->palette.text().color().darker(120); | - |
649 | | - |
650 | if (checkbox->state & State_NoChange) { partially evaluated: checkbox->state & State_NoChange no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
651 | gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft()); | - |
652 | checkMarkColor.setAlpha(80); | - |
653 | gradient.setColorAt(0, checkMarkColor); | - |
654 | checkMarkColor.setAlpha(140); | - |
655 | gradient.setColorAt(1, checkMarkColor); | - |
656 | checkMarkColor.setAlpha(180); | - |
657 | painter->setPen(QPen(checkMarkColor, 1)); | - |
658 | painter->setBrush(gradient); | - |
659 | painter->drawRect(rect.adjusted(3, 3, -3, -3)); | - |
660 | | - |
661 | } else if (checkbox->state & (State_On)) { partially evaluated: checkbox->state & (State_On) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
662 | QPen checkPen = QPen(checkMarkColor, 1.8); | - |
663 | checkMarkColor.setAlpha(210); | - |
664 | painter->translate(-1, 0.5); | - |
665 | painter->setPen(checkPen); | - |
666 | painter->setBrush(Qt::NoBrush); | - |
667 | painter->translate(0.2, 0.0); | - |
668 | | - |
669 | | - |
670 | QPainterPath path; | - |
671 | path.moveTo(5, rect.height() / 2.0); | - |
672 | path.lineTo(rect.width() / 2.0 - 0, rect.height() - 3); | - |
673 | path.lineTo(rect.width() - 2.5, 3); | - |
674 | painter->drawPath(path.translated(rect.topLeft())); | - |
675 | } | 0 |
676 | } | - |
677 | painter->restore(); | - |
678 | break; executed: break; Execution Count:1 | 1 |
679 | case PE_IndicatorRadioButton: | - |
680 | painter->save(); | - |
681 | { | - |
682 | QColor pressedColor = mergedColors(option->palette.base().color(), option->palette.foreground().color(), 85); | - |
683 | painter->setBrush((state & State_Sunken) ? pressedColor : option->palette.base().color()); | - |
684 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
685 | QPainterPath circle; | - |
686 | circle.addEllipse(rect.center() + QPoint(1.0, 1.0), 6.5, 6.5); | - |
687 | painter->setPen(QPen(option->palette.background().color().darker(150))); | - |
688 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) never evaluated: option->state & State_HasFocus never evaluated: option->state & State_KeyboardFocusChange | 0 |
689 | painter->setPen(QPen(highlightedOutline)); never executed: painter->setPen(QPen(highlightedOutline)); | 0 |
690 | painter->drawPath(circle); | - |
691 | | - |
692 | if (state & (State_On )) { never evaluated: state & (State_On ) | 0 |
693 | circle = QPainterPath(); | - |
694 | circle.addEllipse(rect.center() + QPoint(1, 1), 2.8, 2.8); | - |
695 | QColor checkMarkColor = option->palette.text().color().darker(120); | - |
696 | checkMarkColor.setAlpha(200); | - |
697 | painter->setPen(checkMarkColor); | - |
698 | checkMarkColor.setAlpha(180); | - |
699 | painter->setBrush(checkMarkColor); | - |
700 | painter->drawPath(circle); | - |
701 | } | 0 |
702 | } | - |
703 | painter->restore(); | - |
704 | break; | 0 |
705 | case PE_IndicatorToolBarHandle: | - |
706 | { | - |
707 | | - |
708 | if (option->state & State_Horizontal) { never evaluated: option->state & State_Horizontal | 0 |
709 | for (int i = -3 ; i < 2 ; i += 3) { | 0 |
710 | for (int j = -8 ; j < 10 ; j += 3) { | 0 |
711 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - |
712 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - |
713 | } | 0 |
714 | } | 0 |
715 | } else { | 0 |
716 | for (int i = -6 ; i < 12 ; i += 3) { | 0 |
717 | for (int j = -3 ; j < 2 ; j += 3) { | 0 |
718 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - |
719 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - |
720 | } | 0 |
721 | } | 0 |
722 | } | 0 |
723 | break; | 0 |
724 | } | - |
725 | case PE_FrameDefaultButton: | - |
726 | break; executed: break; Execution Count:12 | 12 |
727 | case PE_FrameFocusRect: | - |
728 | if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) { partially evaluated: const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
729 | | - |
730 | if (!(fropt->state & State_KeyboardFocusChange)) partially evaluated: !(fropt->state & State_KeyboardFocusChange) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
731 | return; executed: return; Execution Count:3 | 3 |
732 | QRect rect = option->rect; | - |
733 | | - |
734 | painter->save(); | - |
735 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
736 | painter->translate(0.5, 0.5); | - |
737 | QColor fillcolor = highlightedOutline; | - |
738 | fillcolor.setAlpha(80); | - |
739 | painter->setPen(fillcolor.darker(120)); | - |
740 | fillcolor.setAlpha(30); | - |
741 | QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); | - |
742 | gradient.setColorAt(0, fillcolor.lighter(160)); | - |
743 | gradient.setColorAt(1, fillcolor); | - |
744 | painter->setBrush(gradient); | - |
745 | painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); | - |
746 | painter->restore(); | - |
747 | } | 0 |
748 | break; | 0 |
749 | case PE_PanelButtonCommand: | - |
750 | { | - |
751 | bool isDefault = false; | - |
752 | bool isFlat = false; | - |
753 | bool isDown = (option->state & State_Sunken) || (option->state & State_On); evaluated: (option->state & State_Sunken) yes Evaluation Count:5 | yes Evaluation Count:19 |
partially evaluated: (option->state & State_On) no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
754 | QRect r; | - |
755 | | - |
756 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option)) { evaluated: const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option) yes Evaluation Count:23 | yes Evaluation Count:1 |
| 1-23 |
757 | isDefault = (button->features & QStyleOptionButton::DefaultButton) && (button->state & State_Enabled); evaluated: (button->features & QStyleOptionButton::DefaultButton) yes Evaluation Count:12 | yes Evaluation Count:11 |
partially evaluated: (button->state & State_Enabled) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
758 | isFlat = (button->features & QStyleOptionButton::Flat); | - |
759 | } executed: } Execution Count:23 | 23 |
760 | | - |
761 | if (isFlat && !isDown) { partially evaluated: isFlat no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
762 | if (isDefault) { never evaluated: isDefault | 0 |
763 | r = option->rect.adjusted(0, 1, 0, -1); | - |
764 | painter->setPen(QPen(Qt::black)); | - |
765 | const QLine lines[4] = { | - |
766 | QLine(QPoint(r.left() + 2, r.top()), | - |
767 | QPoint(r.right() - 2, r.top())), | - |
768 | QLine(QPoint(r.left(), r.top() + 2), | - |
769 | QPoint(r.left(), r.bottom() - 2)), | - |
770 | QLine(QPoint(r.right(), r.top() + 2), | - |
771 | QPoint(r.right(), r.bottom() - 2)), | - |
772 | QLine(QPoint(r.left() + 2, r.bottom()), | - |
773 | QPoint(r.right() - 2, r.bottom())) | - |
774 | }; | - |
775 | painter->drawLines(lines, 4); | - |
776 | const QPoint points[4] = { | - |
777 | QPoint(r.right() - 1, r.bottom() - 1), | - |
778 | QPoint(r.right() - 1, r.top() + 1), | - |
779 | QPoint(r.left() + 1, r.bottom() - 1), | - |
780 | QPoint(r.left() + 1, r.top() + 1) | - |
781 | }; | - |
782 | painter->drawPoints(points, 4); | - |
783 | } | 0 |
784 | return; | 0 |
785 | } | - |
786 | | - |
787 | QRect rect = option->rect; QPixmap internalPixmapCache; QImage imageCache; QPainter *p = painter; QString unique = QStyleHelper::uniqueName((QString::fromLatin1("pushbutton-%1").arg(isDefault)), option, option->rect.size()); int txType = painter->deviceTransform().type() | painter->worldTransform().type(); bool doPixmapCache = (txType <= QTransform::TxTranslate) || (painter->deviceTransform().type() == QTransform::TxScale); if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); } else { if (doPixmapCache) { rect.setRect(0, 0, option->rect.width(), option->rect.height()); imageCache = styleCacheImage(option->rect.size()); imageCache.fill(0); p = new QPainter(&imageCache); } partially evaluated: doPixmapCache yes Evaluation Count:13 | no Evaluation Count:0 |
partially evaluated: (txType <= QTransform::TxTranslate) yes Evaluation Count:24 | no Evaluation Count:0 |
never evaluated: (painter->deviceTransform().type() == QTransform::TxScale) partially evaluated: doPixmapCache yes Evaluation Count:24 | no Evaluation Count:0 |
evaluated: QPixmapCache::find(unique, internalPixmapCache) yes Evaluation Count:11 | yes Evaluation Count:13 |
executed: } Execution Count:11 executed: } Execution Count:13 | 0-24 |
788 | r = rect.adjusted(0, 1, -1, 0); | - |
789 | | - |
790 | bool isEnabled = option->state & State_Enabled; | - |
791 | bool hasFocus = (option->state & State_HasFocus && option->state & State_KeyboardFocusChange); evaluated: option->state & State_HasFocus yes Evaluation Count:2 | yes Evaluation Count:11 |
partially evaluated: option->state & State_KeyboardFocusChange no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-11 |
792 | QColor buttonColor = d->buttonColor(option->palette); | - |
793 | | - |
794 | QColor darkOutline = outline; | - |
795 | if (hasFocus | isDefault) { evaluated: hasFocus | isDefault yes Evaluation Count:5 | yes Evaluation Count:8 |
| 5-8 |
796 | darkOutline = highlightedOutline; | - |
797 | } executed: } Execution Count:5 | 5 |
798 | | - |
799 | if (isDefault) evaluated: isDefault yes Evaluation Count:5 | yes Evaluation Count:8 |
| 5-8 |
800 | buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90); executed: buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90); Execution Count:5 | 5 |
801 | | - |
802 | p->setRenderHint(QPainter::Antialiasing, true); | - |
803 | p->translate(0.5, -0.5); | - |
804 | | - |
805 | QLinearGradient gradient = qt_fusion_gradient(rect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104)); | - |
806 | p->setPen(Qt::transparent); | - |
807 | p->setBrush(isDown ? QBrush(buttonColor.darker(110)) : gradient); | - |
808 | p->drawRoundedRect(r, 2.0, 2.0); | - |
809 | p->setBrush(Qt::NoBrush); | - |
810 | | - |
811 | | - |
812 | p->setPen(!isEnabled ? QPen(darkOutline.lighter(115)) : QPen(darkOutline)); | - |
813 | p->drawRoundedRect(r, 2.0, 2.0); | - |
814 | | - |
815 | p->setPen(d->innerContrastLine()); | - |
816 | p->drawRoundedRect(r.adjusted(1, 1, -1, -1), 2.0, 2.0); | - |
817 | | - |
818 | if (doPixmapCache) { p->end(); delete p; internalPixmapCache = QPixmap::fromImage(imageCache); painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); QPixmapCache::insert(unique, internalPixmapCache); } } partially evaluated: doPixmapCache yes Evaluation Count:13 | no Evaluation Count:0 |
executed: } Execution Count:13 executed: } Execution Count:13 | 0-13 |
819 | } | - |
820 | break; executed: break; Execution Count:24 | 24 |
821 | case PE_FrameTabWidget: | - |
822 | painter->save(); | - |
823 | painter->fillRect(option->rect.adjusted(0, 0, -1, -1), tabFrameColor); | - |
824 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) { partially evaluated: const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option) yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
825 | QColor borderColor = outline.lighter(110); | - |
826 | QRect rect = option->rect.adjusted(0, 0, -1, -1); | - |
827 | | - |
828 | | - |
829 | if (twf->shape != QTabBar::RoundedSouth) { partially evaluated: twf->shape != QTabBar::RoundedSouth yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
830 | rect.adjust(0, 0, 0, -1); | - |
831 | QColor alphaShadow(Qt::black); | - |
832 | alphaShadow.setAlpha(15); | - |
833 | painter->setPen(alphaShadow); | - |
834 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); painter->setPen(borderColor); | - |
835 | } executed: } Execution Count:6 | 6 |
836 | | - |
837 | | - |
838 | painter->setPen(outline); | - |
839 | painter->drawRect(rect); | - |
840 | | - |
841 | | - |
842 | painter->setPen(d->innerContrastLine()); | - |
843 | painter->drawRect(rect.adjusted(1, 1, -1, -1)); | - |
844 | | - |
845 | } executed: } Execution Count:6 | 6 |
846 | painter->restore(); | - |
847 | break ; executed: break ; Execution Count:6 | 6 |
848 | | - |
849 | case PE_FrameStatusBarItem: | - |
850 | break; | 0 |
851 | case PE_IndicatorTabClose: | - |
852 | { | - |
853 | const QFusionStylePrivate * const d = d_func(); | - |
854 | if (d->tabBarcloseButtonIcon.isNull()) never evaluated: d->tabBarcloseButtonIcon.isNull() | 0 |
855 | d->tabBarcloseButtonIcon = standardIcon(SP_DialogCloseButton, option, widget); never executed: d->tabBarcloseButtonIcon = standardIcon(SP_DialogCloseButton, option, widget); | 0 |
856 | if ((option->state & State_Enabled) && (option->state & State_MouseOver)) never evaluated: (option->state & State_Enabled) never evaluated: (option->state & State_MouseOver) | 0 |
857 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); never executed: proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | 0 |
858 | QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On); | - |
859 | proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap); | - |
860 | } | - |
861 | break; | 0 |
862 | case PE_PanelMenu: { | - |
863 | painter->save(); | - |
864 | QColor menuBackground = option->palette.base().color().lighter(108); | - |
865 | QColor borderColor = option->palette.background().color().darker(160); | - |
866 | painter->setPen(borderColor); | - |
867 | painter->setBrush(menuBackground); | - |
868 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - |
869 | painter->restore(); | - |
870 | } | - |
871 | break; | 0 |
872 | | - |
873 | default: | - |
874 | QCommonStyle::drawPrimitive(elem, option, painter, widget); | - |
875 | break; executed: break; Execution Count:4 | 4 |
876 | } | - |
877 | } executed: } Execution Count:388 | 388 |
878 | | - |
879 | | - |
880 | | - |
881 | | - |
882 | void QFusionStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, | - |
883 | const QWidget *widget) const | - |
884 | { | - |
885 | const QFusionStylePrivate * const d = d_func(); | - |
886 | QRect rect = option->rect; | - |
887 | QColor outline = d->outline(option->palette); | - |
888 | QColor highlightedOutline = d->highlightedOutline(option->palette); | - |
889 | QColor shadow = d->darkShade(); | - |
890 | | - |
891 | switch (element) { | - |
892 | case CE_ComboBoxLabel: | - |
893 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { evaluated: const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
894 | QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | - |
895 | painter->save(); | - |
896 | painter->setClipRect(editRect); | - |
897 | if (!cb->currentIcon.isNull()) { partially evaluated: !cb->currentIcon.isNull() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
898 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal never evaluated: cb->state & State_Enabled | 0 |
899 | : QIcon::Disabled; | - |
900 | QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); | - |
901 | QRect iconRect(editRect); | - |
902 | iconRect.setWidth(cb->iconSize.width() + 4); | - |
903 | iconRect = alignedRect(cb->direction, | - |
904 | Qt::AlignLeft | Qt::AlignVCenter, | - |
905 | iconRect.size(), editRect); | - |
906 | if (cb->editable) never evaluated: cb->editable | 0 |
907 | painter->fillRect(iconRect, cb->palette.brush(QPalette::Base)); never executed: painter->fillRect(iconRect, cb->palette.brush(QPalette::Base)); | 0 |
908 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); | - |
909 | | - |
910 | if (cb->direction == Qt::RightToLeft) never evaluated: cb->direction == Qt::RightToLeft | 0 |
911 | editRect.translate(-4 - cb->iconSize.width(), 0); never executed: editRect.translate(-4 - cb->iconSize.width(), 0); | 0 |
912 | else | - |
913 | editRect.translate(cb->iconSize.width() + 4, 0); never executed: editRect.translate(cb->iconSize.width() + 4, 0); | 0 |
914 | } | - |
915 | if (!cb->currentText.isEmpty() && !cb->editable) { partially evaluated: !cb->currentText.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !cb->editable | 0-1 |
916 | proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0), | - |
917 | visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), | - |
918 | cb->palette, cb->state & State_Enabled, cb->currentText, | - |
919 | cb->editable ? QPalette::Text : QPalette::ButtonText); | - |
920 | } | 0 |
921 | painter->restore(); | - |
922 | } executed: } Execution Count:1 | 1 |
923 | break; executed: break; Execution Count:2 | 2 |
924 | case CE_Splitter: | - |
925 | { | - |
926 | | - |
927 | if (option->rect.width() > 1 && option->rect.height() > 1) { partially evaluated: option->rect.width() > 1 yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: option->rect.height() > 1 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
928 | | - |
929 | if (option->state & State_Horizontal) { partially evaluated: option->state & State_Horizontal no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
930 | for (int j = -6 ; j< 12 ; j += 3) { | 0 |
931 | painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 2, 2, d->lightShade()); | - |
932 | painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 1, 1, d->darkShade()); | - |
933 | } | 0 |
934 | } else { | 0 |
935 | for (int i = -6; i< 12 ; i += 3) { evaluated: i< 12 yes Evaluation Count:6 | yes Evaluation Count:1 |
| 1-6 |
936 | painter->fillRect(rect.center().x() + i, rect.center().y(), 2, 2, d->lightShade()); | - |
937 | painter->fillRect(rect.center().x() + i, rect.center().y(), 1, 1, d->darkShade()); | - |
938 | } executed: } Execution Count:6 | 6 |
939 | } executed: } Execution Count:1 | 1 |
940 | } | - |
941 | break; executed: break; Execution Count:1 | 1 |
942 | } | - |
943 | case CE_RubberBand: | - |
944 | if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) { partially evaluated: qstyleoption_cast<const QStyleOptionRubberBand *>(option) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
945 | QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); | - |
946 | painter->save(); | - |
947 | QColor penColor = highlight.darker(120); | - |
948 | penColor.setAlpha(180); | - |
949 | painter->setPen(penColor); | - |
950 | QColor dimHighlight(qMin(highlight.red()/2 + 110, 255), | - |
951 | qMin(highlight.green()/2 + 110, 255), | - |
952 | qMin(highlight.blue()/2 + 110, 255)); | - |
953 | dimHighlight.setAlpha(widget && widget->isTopLevel() ? 255 : 80); | - |
954 | QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y())); | - |
955 | gradient.setColorAt(0, dimHighlight.lighter(120)); | - |
956 | gradient.setColorAt(1, dimHighlight); | - |
957 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
958 | painter->translate(0.5, 0.5); | - |
959 | painter->setBrush(dimHighlight); | - |
960 | painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); | - |
961 | QColor innerLine = Qt::white; | - |
962 | innerLine.setAlpha(40); | - |
963 | painter->setPen(innerLine); | - |
964 | painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1); | - |
965 | painter->restore(); | - |
966 | return; | 0 |
967 | } | - |
968 | case CE_SizeGrip: code before this statement executed: case CE_SizeGrip: Execution Count:1 | 1 |
969 | painter->save(); | - |
970 | { | - |
971 | | - |
972 | for (int i = -6; i< 12 ; i += 3) { evaluated: i< 12 yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
973 | for (int j = -6 ; j< 12 ; j += 3) { evaluated: j< 12 yes Evaluation Count:72 | yes Evaluation Count:12 |
| 12-72 |
974 | if ((option->direction == Qt::LeftToRight && i > -j) || (option->direction == Qt::RightToLeft && j > i) ) { partially evaluated: option->direction == Qt::LeftToRight yes Evaluation Count:72 | no Evaluation Count:0 |
evaluated: i > -j yes Evaluation Count:42 | yes Evaluation Count:30 |
partially evaluated: option->direction == Qt::RightToLeft no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-72 |
975 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - |
976 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - |
977 | } executed: } Execution Count:42 | 42 |
978 | } executed: } Execution Count:72 | 72 |
979 | } executed: } Execution Count:12 | 12 |
980 | } | - |
981 | painter->restore(); | - |
982 | break; executed: break; Execution Count:2 | 2 |
983 | case CE_ToolBar: | - |
984 | if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { partially evaluated: const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
985 | | - |
986 | if (!(widget && qobject_cast<const QMainWindow*> (widget->parentWidget()))) never evaluated: qobject_cast<const QMainWindow*> (widget->parentWidget()) | 0 |
987 | break; | 0 |
988 | | - |
989 | | - |
990 | | - |
991 | QLinearGradient gradient(option->rect.topLeft(), option->rect.bottomLeft()); | - |
992 | if (!(option->state & State_Horizontal)) never evaluated: !(option->state & State_Horizontal) | 0 |
993 | gradient = QLinearGradient(rect.left(), rect.center().y(), | 0 |
994 | rect.right(), rect.center().y()); never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 |
995 | gradient.setColorAt(0, option->palette.window().color().lighter(104)); | - |
996 | gradient.setColorAt(1, option->palette.window().color()); | - |
997 | painter->fillRect(option->rect, gradient); | - |
998 | | - |
999 | QColor light = d->lightShade(); | - |
1000 | QColor shadow = d->darkShade(); | - |
1001 | | - |
1002 | QPen oldPen = painter->pen(); | - |
1003 | if (toolBar->toolBarArea == Qt::TopToolBarArea) { never evaluated: toolBar->toolBarArea == Qt::TopToolBarArea | 0 |
1004 | if (toolBar->positionOfLine == QStyleOptionToolBar::End never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1005 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne | 0 |
1006 | | - |
1007 | | - |
1008 | | - |
1009 | painter->setPen(light); | - |
1010 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - |
1011 | painter->setPen(shadow); | - |
1012 | painter->drawLine(option->rect.left(), option->rect.bottom() - 1, | - |
1013 | option->rect.right(), option->rect.bottom() - 1); | - |
1014 | } else { | 0 |
1015 | | - |
1016 | painter->setPen(shadow); | - |
1017 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - |
1018 | } | 0 |
1019 | | - |
1020 | painter->setPen(light); | - |
1021 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - |
1022 | } else if (toolBar->toolBarArea == Qt::BottomToolBarArea) { never evaluated: toolBar->toolBarArea == Qt::BottomToolBarArea | 0 |
1023 | if (toolBar->positionOfLine == QStyleOptionToolBar::End never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1024 | || toolBar->positionOfLine == QStyleOptionToolBar::Middle) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::Middle | 0 |
1025 | | - |
1026 | | - |
1027 | painter->setPen(shadow); | - |
1028 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - |
1029 | } | 0 |
1030 | if (toolBar->positionOfLine == QStyleOptionToolBar::Beginning never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::Beginning | 0 |
1031 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne | 0 |
1032 | | - |
1033 | | - |
1034 | | - |
1035 | | - |
1036 | | - |
1037 | | - |
1038 | painter->setPen(shadow); | - |
1039 | painter->drawLine(option->rect.left(), option->rect.bottom() - 1, | - |
1040 | option->rect.right(), option->rect.bottom() - 1); | - |
1041 | painter->setPen(light); | - |
1042 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - |
1043 | } | 0 |
1044 | if (toolBar->positionOfLine == QStyleOptionToolBar::End) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1045 | painter->setPen(shadow); | - |
1046 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - |
1047 | painter->setPen(light); | - |
1048 | painter->drawLine(option->rect.left(), option->rect.top() + 1, | - |
1049 | option->rect.right(), option->rect.top() + 1); | - |
1050 | | - |
1051 | } else { | 0 |
1052 | | - |
1053 | painter->setPen(light); | - |
1054 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - |
1055 | } | 0 |
1056 | } | - |
1057 | if (toolBar->toolBarArea == Qt::LeftToolBarArea) { never evaluated: toolBar->toolBarArea == Qt::LeftToolBarArea | 0 |
1058 | if (toolBar->positionOfLine == QStyleOptionToolBar::Middle never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::Middle | 0 |
1059 | || toolBar->positionOfLine == QStyleOptionToolBar::End) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1060 | | - |
1061 | | - |
1062 | painter->setPen(light); | - |
1063 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - |
1064 | } | 0 |
1065 | if (toolBar->positionOfLine == QStyleOptionToolBar::End) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1066 | | - |
1067 | painter->setPen(shadow); | - |
1068 | painter->drawLine(option->rect.right() - 1, option->rect.top(), | - |
1069 | option->rect.right() - 1, option->rect.bottom()); | - |
1070 | painter->setPen(light); | - |
1071 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - |
1072 | } else { | 0 |
1073 | | - |
1074 | painter->setPen(shadow); | - |
1075 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - |
1076 | } | 0 |
1077 | } else if (toolBar->toolBarArea == Qt::RightToolBarArea) { never evaluated: toolBar->toolBarArea == Qt::RightToolBarArea | 0 |
1078 | if (toolBar->positionOfLine == QStyleOptionToolBar::Middle never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::Middle | 0 |
1079 | || toolBar->positionOfLine == QStyleOptionToolBar::End) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1080 | | - |
1081 | painter->setPen(shadow); | - |
1082 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - |
1083 | } | 0 |
1084 | if (toolBar->positionOfLine == QStyleOptionToolBar::End never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::End | 0 |
1085 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) { never evaluated: toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne | 0 |
1086 | | - |
1087 | | - |
1088 | painter->setPen(shadow); | - |
1089 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - |
1090 | | - |
1091 | painter->setPen(light); | - |
1092 | painter->drawLine(option->rect.left() + 1, option->rect.top(), | - |
1093 | option->rect.left() + 1, option->rect.bottom()); | - |
1094 | } else { | 0 |
1095 | | - |
1096 | painter->setPen(light); | - |
1097 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - |
1098 | } | 0 |
1099 | } | - |
1100 | painter->setPen(oldPen); | - |
1101 | } | 0 |
1102 | break; executed: break; Execution Count:1 | 1 |
1103 | case CE_DockWidgetTitle: | - |
1104 | painter->save(); | - |
1105 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { partially evaluated: const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1106 | bool verticalTitleBar = dwOpt->verticalTitleBar; | - |
1107 | | - |
1108 | QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget); | - |
1109 | if (verticalTitleBar) { never evaluated: verticalTitleBar | 0 |
1110 | QRect rect = dwOpt->rect; | - |
1111 | QRect r = rect; | - |
1112 | QSize s = r.size(); | - |
1113 | s.transpose(); | - |
1114 | r.setSize(s); | - |
1115 | titleRect = QRect(r.left() + rect.bottom() | - |
1116 | - titleRect.bottom(), | - |
1117 | r.top() + titleRect.left() - rect.left(), | - |
1118 | titleRect.height(), titleRect.width()); | - |
1119 | } | 0 |
1120 | | - |
1121 | if (!dwOpt->title.isEmpty()) { never evaluated: !dwOpt->title.isEmpty() | 0 |
1122 | QString titleText | - |
1123 | = painter->fontMetrics().elidedText(dwOpt->title, | - |
1124 | Qt::ElideRight, titleRect.width()); | - |
1125 | proxy()->drawItemText(painter, | - |
1126 | titleRect, | - |
1127 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, | - |
1128 | dwOpt->state & State_Enabled, titleText, | - |
1129 | QPalette::WindowText); | - |
1130 | } | 0 |
1131 | } | 0 |
1132 | painter->restore(); | - |
1133 | break; executed: break; Execution Count:1 | 1 |
1134 | case CE_HeaderSection: | - |
1135 | painter->save(); | - |
1136 | | - |
1137 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { partially evaluated: const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1138 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size()); | - |
1139 | pixmapName += QString::number(- int(header->position)); | - |
1140 | pixmapName += QString::number(- int(header->orientation)); | - |
1141 | | - |
1142 | QPixmap cache; | - |
1143 | if (!QPixmapCache::find(pixmapName, cache)) { never evaluated: !QPixmapCache::find(pixmapName, cache) | 0 |
1144 | cache = styleCachePixmap(rect.size()); | - |
1145 | cache.fill(Qt::transparent); | - |
1146 | QRect pixmapRect(0, 0, rect.width(), rect.height()); | - |
1147 | QPainter cachePainter(&cache); | - |
1148 | QColor buttonColor = d->buttonColor(option->palette); | - |
1149 | QColor gradientStopColor; | - |
1150 | QColor gradientStartColor = buttonColor.lighter(104); | - |
1151 | gradientStopColor = buttonColor.darker(102); | - |
1152 | QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - |
1153 | | - |
1154 | if (option->palette.background().gradient()) { never evaluated: option->palette.background().gradient() | 0 |
1155 | gradient.setStops(option->palette.background().gradient()->stops()); | - |
1156 | } else { | 0 |
1157 | QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 60); | - |
1158 | QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40); | - |
1159 | gradient.setColorAt(0, gradientStartColor); | - |
1160 | gradient.setColorAt(0.5, midColor1); | - |
1161 | gradient.setColorAt(0.501, midColor2); | - |
1162 | gradient.setColorAt(0.92, gradientStopColor); | - |
1163 | gradient.setColorAt(1, gradientStopColor.darker(104)); | - |
1164 | } | 0 |
1165 | cachePainter.fillRect(pixmapRect, gradient); | - |
1166 | cachePainter.setPen(d->innerContrastLine()); | - |
1167 | cachePainter.setBrush(Qt::NoBrush); | - |
1168 | cachePainter.drawLine(pixmapRect.topLeft(), pixmapRect.topRight()); | - |
1169 | cachePainter.setPen(d->outline(option->palette)); | - |
1170 | cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight()); | - |
1171 | | - |
1172 | if (header->orientation == Qt::Horizontal && never evaluated: header->orientation == Qt::Horizontal | 0 |
1173 | header->position != QStyleOptionHeader::End && never evaluated: header->position != QStyleOptionHeader::End | 0 |
1174 | header->position != QStyleOptionHeader::OnlyOneSection) { never evaluated: header->position != QStyleOptionHeader::OnlyOneSection | 0 |
1175 | cachePainter.setPen(QColor(0, 0, 0, 40)); | - |
1176 | cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight() + QPoint(0, -1)); | - |
1177 | cachePainter.setPen(d->innerContrastLine()); | - |
1178 | cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 0), pixmapRect.bottomRight() + QPoint(-1, -1)); | - |
1179 | } else if (header->orientation == Qt::Vertical) { never evaluated: header->orientation == Qt::Vertical | 0 |
1180 | cachePainter.setPen(d->outline(option->palette)); | - |
1181 | cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - |
1182 | } | 0 |
1183 | cachePainter.end(); | - |
1184 | QPixmapCache::insert(pixmapName, cache); | - |
1185 | } | 0 |
1186 | painter->drawPixmap(rect.topLeft(), cache); | - |
1187 | } | 0 |
1188 | painter->restore(); | - |
1189 | break; executed: break; Execution Count:1 | 1 |
1190 | case CE_ProgressBarGroove: | - |
1191 | painter->save(); | - |
1192 | { | - |
1193 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
1194 | painter->translate(0.5, 0.5); | - |
1195 | | - |
1196 | QColor shadowAlpha = Qt::black; | - |
1197 | shadowAlpha.setAlpha(16); | - |
1198 | painter->setPen(shadowAlpha); | - |
1199 | painter->drawLine(rect.topLeft() - QPoint(0, 1), rect.topRight() - QPoint(0, 1)); | - |
1200 | | - |
1201 | painter->setBrush(option->palette.base()); | - |
1202 | painter->setPen(QPen(outline)); | - |
1203 | painter->drawRoundedRect(rect.adjusted(0, 0, -1, -1), 2, 2); | - |
1204 | | - |
1205 | | - |
1206 | painter->setPen(d->topShadow()); | - |
1207 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - |
1208 | QPoint(rect.right() - 1, rect.top() + 1)); | - |
1209 | } | - |
1210 | painter->restore(); | - |
1211 | break; executed: break; Execution Count:3 | 3 |
1212 | case CE_ProgressBarContents: | - |
1213 | painter->save(); | - |
1214 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
1215 | painter->translate(0.5, 0.5); | - |
1216 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { evaluated: const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1217 | bool vertical = false; | - |
1218 | bool inverted = false; | - |
1219 | bool indeterminate = (bar->minimum == 0 && bar->maximum == 0); partially evaluated: bar->minimum == 0 yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: bar->maximum == 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1220 | bool complete = bar->progress == bar->maximum; | - |
1221 | | - |
1222 | | - |
1223 | vertical = (bar->orientation == Qt::Vertical); | - |
1224 | inverted = bar->invertedAppearance; | - |
1225 | | - |
1226 | | - |
1227 | | - |
1228 | | - |
1229 | if (vertical) { partially evaluated: vertical no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1230 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); | - |
1231 | QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0); | - |
1232 | m.rotate(90.0); | - |
1233 | painter->setTransform(m, true); | - |
1234 | } | 0 |
1235 | | - |
1236 | int maxWidth = rect.width(); | - |
1237 | int minWidth = 0; | - |
1238 | qreal progress = qMax(bar->progress, bar->minimum); | - |
1239 | int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - |
1240 | int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth); partially evaluated: indeterminate no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1241 | | - |
1242 | bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical; partially evaluated: !vertical yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: (bar->direction == Qt::RightToLeft) no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: vertical no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1243 | if (inverted) partially evaluated: inverted no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1244 | reverse = !reverse; never executed: reverse = !reverse; | 0 |
1245 | | - |
1246 | int step = 0; | - |
1247 | QRect progressBar; | - |
1248 | QColor highlight = d->highlight(option->palette); | - |
1249 | QColor highlightedoutline = highlight.darker(140); | - |
1250 | if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb())) partially evaluated: qGray(outline.rgb()) > qGray(highlightedoutline.rgb()) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1251 | outline = highlightedoutline; executed: outline = highlightedoutline; Execution Count:2 | 2 |
1252 | | - |
1253 | if (!indeterminate) { partially evaluated: !indeterminate yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1254 | QColor innerShadow(Qt::black); | - |
1255 | innerShadow.setAlpha(35); | - |
1256 | painter->setPen(innerShadow); | - |
1257 | if (!reverse) { partially evaluated: !reverse yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1258 | progressBar.setRect(rect.left(), rect.top(), width - 1, rect.height() - 1); | - |
1259 | if (!complete) { partially evaluated: !complete yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1260 | painter->drawLine(progressBar.topRight() + QPoint(2, 1), progressBar.bottomRight() + QPoint(2, 0)); | - |
1261 | painter->setPen(QPen(highlight.darker(140))); | - |
1262 | painter->drawLine(progressBar.topRight() + QPoint(1, 1), progressBar.bottomRight() + QPoint(1, 0)); | - |
1263 | } executed: } Execution Count:2 | 2 |
1264 | } else { executed: } Execution Count:2 | 2 |
1265 | progressBar.setRect(rect.right() - width - 1, rect.top(), width + 2, rect.height() - 1); | - |
1266 | if (!complete) { never evaluated: !complete | 0 |
1267 | painter->drawLine(progressBar.topLeft() + QPoint(-2, 1), progressBar.bottomLeft() + QPoint(-2, 0)); | - |
1268 | painter->setPen(QPen(highlight.darker(140))); | - |
1269 | painter->drawLine(progressBar.topLeft() + QPoint(-1, 1), progressBar.bottomLeft() + QPoint(-1, 0)); | - |
1270 | } | 0 |
1271 | } | 0 |
1272 | } else { | - |
1273 | progressBar.setRect(rect.left(), rect.top(), rect.width() - 1, rect.height() - 1); | - |
1274 | } | 0 |
1275 | | - |
1276 | if (indeterminate || bar->progress > bar->minimum) { partially evaluated: indeterminate no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: bar->progress > bar->minimum no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1277 | | - |
1278 | painter->setPen(QPen(outline)); | - |
1279 | | - |
1280 | QColor highlightedGradientStartColor = highlight.lighter(120); | - |
1281 | QColor highlightedGradientStopColor = highlight; | - |
1282 | QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y())); | - |
1283 | gradient.setColorAt(0, highlightedGradientStartColor); | - |
1284 | gradient.setColorAt(1, highlightedGradientStopColor); | - |
1285 | | - |
1286 | painter->setBrush(gradient); | - |
1287 | | - |
1288 | painter->save(); | - |
1289 | if (!complete && !indeterminate) never evaluated: !complete never evaluated: !indeterminate | 0 |
1290 | painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1)); never executed: painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1)); | 0 |
1291 | QRect fillRect = progressBar.adjusted( !indeterminate && !complete && reverse ? -2 : 0, 0, | - |
1292 | indeterminate || complete || reverse ? 0 : 2, 0); | - |
1293 | painter->drawRoundedRect(fillRect, 2, 2); | - |
1294 | painter->restore(); | - |
1295 | | - |
1296 | painter->setBrush(Qt::NoBrush); | - |
1297 | painter->setPen(QColor(255, 255, 255, 50)); | - |
1298 | painter->drawRoundedRect(progressBar.adjusted(1, 1, -1, -1), 1, 1); | - |
1299 | | - |
1300 | if (!indeterminate) { never evaluated: !indeterminate | 0 |
1301 | (const_cast<QFusionStylePrivate*>(d))->stopAnimation(option->styleObject); | - |
1302 | } else { | 0 |
1303 | highlightedGradientStartColor.setAlpha(120); | - |
1304 | painter->setPen(QPen(highlightedGradientStartColor, 9.0)); | - |
1305 | painter->setClipRect(progressBar.adjusted(1, 1, -1, -1)); | - |
1306 | | - |
1307 | if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject))) never evaluated: QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject)) | 0 |
1308 | step = animation->animationStep() % 22; never executed: step = animation->animationStep() % 22; | 0 |
1309 | else | - |
1310 | (const_cast<QFusionStylePrivate*>(d))->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); never executed: (const_cast<QFusionStylePrivate*>(d))->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); | 0 |
1311 | | - |
1312 | for (int x = progressBar.left() - rect.height(); x < rect.right() ; x += 22) never evaluated: x < rect.right() | 0 |
1313 | painter->drawLine(x + step, progressBar.bottom() + 1, | 0 |
1314 | x + rect.height() + step, progressBar.top() - 2); never executed: painter->drawLine(x + step, progressBar.bottom() + 1, x + rect.height() + step, progressBar.top() - 2); | 0 |
1315 | } | 0 |
1316 | } | - |
1317 | } executed: } Execution Count:2 | 2 |
1318 | painter->restore(); | - |
1319 | break; executed: break; Execution Count:3 | 3 |
1320 | case CE_ProgressBarLabel: | - |
1321 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { evaluated: const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1322 | QRect leftRect; | - |
1323 | QRect rect = bar->rect; | - |
1324 | QColor textColor = option->palette.text().color(); | - |
1325 | QColor alternateTextColor = d->highlightedText(option->palette); | - |
1326 | | - |
1327 | painter->save(); | - |
1328 | bool vertical = false, inverted = false; | - |
1329 | vertical = (bar->orientation == Qt::Vertical); | - |
1330 | inverted = bar->invertedAppearance; | - |
1331 | if (vertical) partially evaluated: vertical no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1332 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); never executed: rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); | 0 |
1333 | const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() / | - |
1334 | qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - |
1335 | if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width()) partially evaluated: progressIndicatorPos >= 0 no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: progressIndicatorPos <= rect.width() | 0-2 |
1336 | leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); never executed: leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); | 0 |
1337 | if (vertical) partially evaluated: vertical no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1338 | leftRect.translate(rect.width() - progressIndicatorPos, 0); never executed: leftRect.translate(rect.width() - progressIndicatorPos, 0); | 0 |
1339 | | - |
1340 | bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) || partially evaluated: !vertical yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: (bar->direction == Qt::RightToLeft) no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !inverted | 0-2 |
1341 | ((bar->direction == Qt::LeftToRight) && inverted))); partially evaluated: (bar->direction == Qt::LeftToRight) yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: inverted no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1342 | | - |
1343 | QRegion rightRect = rect; | - |
1344 | rightRect = rightRect.subtracted(leftRect); | - |
1345 | painter->setClipRegion(rightRect); | - |
1346 | painter->setPen(flip ? alternateTextColor : textColor); | - |
1347 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - |
1348 | if (!leftRect.isNull()) { partially evaluated: !leftRect.isNull() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1349 | painter->setPen(flip ? textColor : alternateTextColor); | - |
1350 | painter->setClipRect(leftRect); | - |
1351 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - |
1352 | } | 0 |
1353 | painter->restore(); | - |
1354 | } executed: } Execution Count:2 | 2 |
1355 | break; executed: break; Execution Count:3 | 3 |
1356 | case CE_MenuBarItem: | - |
1357 | painter->save(); | - |
1358 | if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) partially evaluated: const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1359 | { | - |
1360 | QStyleOptionMenuItem item = *mbi; | - |
1361 | item.rect = mbi->rect.adjusted(0, 1, 0, -3); | - |
1362 | QColor highlightOutline = option->palette.highlight().color().darker(125); | - |
1363 | painter->fillRect(rect, option->palette.window()); | - |
1364 | | - |
1365 | QCommonStyle::drawControl(element, &item, painter, widget); | - |
1366 | | - |
1367 | bool act = mbi->state & State_Selected && mbi->state & State_Sunken; never evaluated: mbi->state & State_Selected never evaluated: mbi->state & State_Sunken | 0 |
1368 | bool dis = !(mbi->state & State_Enabled); | - |
1369 | | - |
1370 | QRect r = option->rect; | - |
1371 | if (act) { | 0 |
1372 | painter->setBrush(option->palette.highlight().color()); | - |
1373 | painter->setPen(QPen(highlightOutline)); | - |
1374 | painter->drawRect(r.adjusted(0, 0, -1, -1)); | - |
1375 | | - |
1376 | | - |
1377 | | - |
1378 | | - |
1379 | QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText; | 0 |
1380 | uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - |
1381 | if (!styleHint(SH_UnderlineShortcut, mbi, widget)) never evaluated: !styleHint(SH_UnderlineShortcut, mbi, widget) | 0 |
1382 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 |
1383 | proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole); | - |
1384 | } else { | 0 |
1385 | | - |
1386 | QColor shadow = mergedColors(option->palette.background().color().darker(120), | - |
1387 | outline.lighter(140), 60); | - |
1388 | painter->setPen(QPen(shadow)); | - |
1389 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - |
1390 | } | 0 |
1391 | } | - |
1392 | painter->restore(); | - |
1393 | break; executed: break; Execution Count:1 | 1 |
1394 | case CE_MenuItem: | - |
1395 | painter->save(); | - |
1396 | | - |
1397 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { partially evaluated: const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1398 | QColor highlightOutline = highlightedOutline; | - |
1399 | QColor highlight = option->palette.highlight().color(); | - |
1400 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { never evaluated: menuItem->menuItemType == QStyleOptionMenuItem::Separator | 0 |
1401 | int w = 0; | - |
1402 | if (!menuItem->text.isEmpty()) { never evaluated: !menuItem->text.isEmpty() | 0 |
1403 | painter->setFont(menuItem->font); | - |
1404 | proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, | - |
1405 | menuItem->palette, menuItem->state & State_Enabled, menuItem->text, | - |
1406 | QPalette::Text); | - |
1407 | w = menuItem->fontMetrics.width(menuItem->text) + 5; | - |
1408 | } | 0 |
1409 | painter->setPen(shadow.lighter(106)); | - |
1410 | bool reverse = menuItem->direction == Qt::RightToLeft; | - |
1411 | painter->drawLine(menuItem->rect.left() + 5 + (reverse ? 0 : w), menuItem->rect.center().y(), | - |
1412 | menuItem->rect.right() - 5 - (reverse ? w : 0), menuItem->rect.center().y()); | - |
1413 | painter->restore(); | - |
1414 | break; | 0 |
1415 | } | - |
1416 | bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled; never evaluated: menuItem->state & State_Selected never evaluated: menuItem->state & State_Enabled | 0 |
1417 | if (selected) { never evaluated: selected | 0 |
1418 | QRect r = option->rect; | - |
1419 | painter->fillRect(r, highlight); | - |
1420 | painter->setPen(QPen(highlightOutline)); | - |
1421 | const QLine lines[4] = { | - |
1422 | QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())), | - |
1423 | QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())), | - |
1424 | QLine(QPoint(r.left(), r.top()), QPoint(r.left(), r.bottom())), | - |
1425 | QLine(QPoint(r.right() , r.top()), QPoint(r.right(), r.bottom())), | - |
1426 | }; | - |
1427 | painter->drawLines(lines, 4); | - |
1428 | } | 0 |
1429 | bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; | - |
1430 | bool checked = menuItem->checked; | - |
1431 | bool sunken = menuItem->state & State_Sunken; | - |
1432 | bool enabled = menuItem->state & State_Enabled; | - |
1433 | | - |
1434 | bool ignoreCheckMark = false; | - |
1435 | int checkcol = qMax(menuItem->maxIconWidth, 20); | - |
1436 | | - |
1437 | if (qobject_cast<const QComboBox*>(widget)) never evaluated: qobject_cast<const QComboBox*>(widget) | 0 |
1438 | ignoreCheckMark = true; never executed: ignoreCheckMark = true; | 0 |
1439 | | - |
1440 | if (!ignoreCheckMark) { never evaluated: !ignoreCheckMark | 0 |
1441 | | - |
1442 | QRect checkRect(option->rect.left() + 7, option->rect.center().y() - 6, 14, 14); | - |
1443 | checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect); | - |
1444 | if (checkable) { never evaluated: checkable | 0 |
1445 | if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) { never evaluated: menuItem->checkType & QStyleOptionMenuItem::Exclusive | 0 |
1446 | | - |
1447 | if (checked || sunken) { | 0 |
1448 | painter->setRenderHint(QPainter::Antialiasing); | - |
1449 | painter->setPen(Qt::NoPen); | - |
1450 | | - |
1451 | QPalette::ColorRole textRole = !enabled ? QPalette::Text: never evaluated: !enabled | 0 |
1452 | selected ? QPalette::HighlightedText : QPalette::ButtonText; | - |
1453 | painter->setBrush(option->palette.brush( option->palette.currentColorGroup(), textRole)); | - |
1454 | painter->drawEllipse(checkRect.adjusted(4, 4, -4, -4)); | - |
1455 | } | 0 |
1456 | } else { | 0 |
1457 | | - |
1458 | if (menuItem->icon.isNull()) { never evaluated: menuItem->icon.isNull() | 0 |
1459 | QStyleOptionButton box; | - |
1460 | box.QStyleOption::operator=(*option); | - |
1461 | box.rect = checkRect; | - |
1462 | if (checked) | 0 |
1463 | box.state |= State_On; never executed: box.state |= State_On; | 0 |
1464 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - |
1465 | } | 0 |
1466 | } | 0 |
1467 | } | - |
1468 | } else { | 0 |
1469 | if (menuItem->icon.isNull()) never evaluated: menuItem->icon.isNull() | 0 |
1470 | checkcol = 0; never executed: checkcol = 0; | 0 |
1471 | else | - |
1472 | checkcol = menuItem->maxIconWidth; never executed: checkcol = menuItem->maxIconWidth; | 0 |
1473 | } | - |
1474 | | - |
1475 | | - |
1476 | bool dis = !(menuItem->state & State_Enabled); | - |
1477 | bool act = menuItem->state & State_Selected; | - |
1478 | const QStyleOption *opt = option; | - |
1479 | const QStyleOptionMenuItem *menuitem = menuItem; | - |
1480 | | - |
1481 | QPainter *p = painter; | - |
1482 | QRect vCheckRect = visualRect(opt->direction, menuitem->rect, | - |
1483 | QRect(menuitem->rect.x() + 4, menuitem->rect.y(), | - |
1484 | checkcol, menuitem->rect.height())); | - |
1485 | if (!menuItem->icon.isNull()) { never evaluated: !menuItem->icon.isNull() | 0 |
1486 | QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal; | 0 |
1487 | if (act && !dis) | 0 |
1488 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 |
1489 | QPixmap pixmap; | - |
1490 | | - |
1491 | int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); | - |
1492 | QSize iconSize(smallIconSize, smallIconSize); | - |
1493 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) never evaluated: const QComboBox *combo = qobject_cast<const QComboBox*>(widget) | 0 |
1494 | iconSize = combo->iconSize(); never executed: iconSize = combo->iconSize(); | 0 |
1495 | if (checked) | 0 |
1496 | pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); | 0 |
1497 | else | - |
1498 | pixmap = menuItem->icon.pixmap(iconSize, mode); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode); | 0 |
1499 | | - |
1500 | int pixw = pixmap.width(); | - |
1501 | int pixh = pixmap.height(); | - |
1502 | | - |
1503 | QRect pmr(0, 0, pixw, pixh); | - |
1504 | pmr.moveCenter(vCheckRect.center()); | - |
1505 | painter->setPen(menuItem->palette.text().color()); | - |
1506 | if (checkable && checked) { never evaluated: checkable | 0 |
1507 | QStyleOption opt = *option; | - |
1508 | if (act) { | 0 |
1509 | QColor activeColor = mergedColors(option->palette.background().color(), | - |
1510 | option->palette.highlight().color()); | - |
1511 | opt.palette.setBrush(QPalette::Button, activeColor); | - |
1512 | } | 0 |
1513 | opt.state |= State_Sunken; | - |
1514 | opt.rect = vCheckRect; | - |
1515 | proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); | - |
1516 | } | 0 |
1517 | painter->drawPixmap(pmr.topLeft(), pixmap); | - |
1518 | } | 0 |
1519 | if (selected) { never evaluated: selected | 0 |
1520 | painter->setPen(menuItem->palette.highlightedText().color()); | - |
1521 | } else { | 0 |
1522 | painter->setPen(menuItem->palette.text().color()); | - |
1523 | } | 0 |
1524 | int x, y, w, h; | - |
1525 | menuitem->rect.getRect(&x, &y, &w, &h); | - |
1526 | int tab = menuitem->tabWidth; | - |
1527 | QColor discol; | - |
1528 | if (dis) { | 0 |
1529 | discol = menuitem->palette.text().color(); | - |
1530 | p->setPen(discol); | - |
1531 | } | 0 |
1532 | int xm = windowsItemFrame + checkcol + windowsItemHMargin + 2; | - |
1533 | int xpos = menuitem->rect.x() + xm; | - |
1534 | | - |
1535 | QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); | - |
1536 | QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); | - |
1537 | QString s = menuitem->text; | - |
1538 | if (!s.isEmpty()) { never evaluated: !s.isEmpty() | 0 |
1539 | p->save(); | - |
1540 | int t = s.indexOf(QLatin1Char('\t')); | - |
1541 | int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - |
1542 | if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) never evaluated: !styleHint(SH_UnderlineShortcut, menuitem, widget) | 0 |
1543 | text_flags |= Qt::TextHideMnemonic; never executed: text_flags |= Qt::TextHideMnemonic; | 0 |
1544 | text_flags |= Qt::AlignLeft; | - |
1545 | if (t >= 0) { | 0 |
1546 | QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, | - |
1547 | QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); | - |
1548 | if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { never evaluated: proxy()->styleHint(SH_EtchDisabledText, option, widget) | 0 |
1549 | p->setPen(menuitem->palette.light().color()); | - |
1550 | p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1)); | - |
1551 | p->setPen(discol); | - |
1552 | } | 0 |
1553 | p->drawText(vShortcutRect, text_flags, s.mid(t + 1)); | - |
1554 | s = s.left(t); | - |
1555 | } | 0 |
1556 | QFont font = menuitem->font; | - |
1557 | | - |
1558 | | - |
1559 | | - |
1560 | | - |
1561 | | - |
1562 | font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF()); | - |
1563 | | - |
1564 | if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) never evaluated: menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem | 0 |
1565 | font.setBold(true); never executed: font.setBold(true); | 0 |
1566 | | - |
1567 | p->setFont(font); | - |
1568 | if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { never evaluated: proxy()->styleHint(SH_EtchDisabledText, option, widget) | 0 |
1569 | p->setPen(menuitem->palette.light().color()); | - |
1570 | p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t)); | - |
1571 | p->setPen(discol); | - |
1572 | } | 0 |
1573 | p->drawText(vTextRect, text_flags, s.left(t)); | - |
1574 | p->restore(); | - |
1575 | } | 0 |
1576 | | - |
1577 | | - |
1578 | if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) { never evaluated: menuItem->menuItemType == QStyleOptionMenuItem::SubMenu | 0 |
1579 | int dim = (menuItem->rect.height() - 4) / 2; | - |
1580 | PrimitiveElement arrow; | - |
1581 | arrow = QApplication::isRightToLeft() ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight; never evaluated: QApplication::isRightToLeft() | 0 |
1582 | int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim; | - |
1583 | QRect vSubMenuRect = visualRect(option->direction, menuItem->rect, | - |
1584 | QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim)); | - |
1585 | QStyleOptionMenuItem newMI = *menuItem; | - |
1586 | newMI.rect = vSubMenuRect; | - |
1587 | newMI.state = !enabled ? State_None : State_Enabled; never evaluated: !enabled | 0 |
1588 | if (selected) never evaluated: selected | 0 |
1589 | newMI.palette.setColor(QPalette::Foreground, | 0 |
1590 | newMI.palette.highlightedText().color()); never executed: newMI.palette.setColor(QPalette::Foreground, newMI.palette.highlightedText().color()); | 0 |
1591 | proxy()->drawPrimitive(arrow, &newMI, painter, widget); | - |
1592 | } | 0 |
1593 | } | 0 |
1594 | painter->restore(); | - |
1595 | break; executed: break; Execution Count:1 | 1 |
1596 | case CE_MenuHMargin: | - |
1597 | case CE_MenuVMargin: | - |
1598 | break; executed: break; Execution Count:2 | 2 |
1599 | case CE_MenuEmptyArea: | - |
1600 | break; executed: break; Execution Count:1 | 1 |
1601 | case CE_PushButton: | - |
1602 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { evaluated: const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option) yes Evaluation Count:22 | yes Evaluation Count:1 |
| 1-22 |
1603 | proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); | - |
1604 | QStyleOptionButton subopt = *btn; | - |
1605 | subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | - |
1606 | proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget); | - |
1607 | } executed: } Execution Count:22 | 22 |
1608 | break; executed: break; Execution Count:23 | 23 |
1609 | case CE_PushButtonLabel: | - |
1610 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { evaluated: const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option) yes Evaluation Count:22 | yes Evaluation Count:1 |
| 1-22 |
1611 | QRect ir = button->rect; | - |
1612 | uint tf = Qt::AlignVCenter; | - |
1613 | if (styleHint(SH_UnderlineShortcut, button, widget)) partially evaluated: styleHint(SH_UnderlineShortcut, button, widget) yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
1614 | tf |= Qt::TextShowMnemonic; executed: tf |= Qt::TextShowMnemonic; Execution Count:22 | 22 |
1615 | else | - |
1616 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 |
1617 | | - |
1618 | if (!button->icon.isNull()) { partially evaluated: !button->icon.isNull() no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
1619 | | - |
1620 | QPoint point; | - |
1621 | | - |
1622 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal never evaluated: button->state & State_Enabled | 0 |
1623 | : QIcon::Disabled; | - |
1624 | if (mode == QIcon::Normal && button->state & State_HasFocus) never evaluated: mode == QIcon::Normal never evaluated: button->state & State_HasFocus | 0 |
1625 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 |
1626 | QIcon::State state = QIcon::Off; | - |
1627 | if (button->state & State_On) never evaluated: button->state & State_On | 0 |
1628 | state = QIcon::On; never executed: state = QIcon::On; | 0 |
1629 | | - |
1630 | QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); | - |
1631 | int w = pixmap.width(); | - |
1632 | int h = pixmap.height(); | - |
1633 | | - |
1634 | if (!button->text.isEmpty()) never evaluated: !button->text.isEmpty() | 0 |
1635 | w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 2; never executed: w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 2; | 0 |
1636 | | - |
1637 | point = QPoint(ir.x() + ir.width() / 2 - w / 2, | - |
1638 | ir.y() + ir.height() / 2 - h / 2); | - |
1639 | | - |
1640 | if (button->direction == Qt::RightToLeft) never evaluated: button->direction == Qt::RightToLeft | 0 |
1641 | point.rx() += pixmap.width(); never executed: point.rx() += pixmap.width(); | 0 |
1642 | | - |
1643 | painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); | - |
1644 | | - |
1645 | if (button->direction == Qt::RightToLeft) never evaluated: button->direction == Qt::RightToLeft | 0 |
1646 | ir.translate(-point.x() - 2, 0); never executed: ir.translate(-point.x() - 2, 0); | 0 |
1647 | else | - |
1648 | ir.translate(point.x() + pixmap.width(), 0); never executed: ir.translate(point.x() + pixmap.width(), 0); | 0 |
1649 | | - |
1650 | | - |
1651 | if (!button->text.isEmpty()) never evaluated: !button->text.isEmpty() | 0 |
1652 | tf |= Qt::AlignLeft; never executed: tf |= Qt::AlignLeft; | 0 |
1653 | | - |
1654 | } else { | 0 |
1655 | tf |= Qt::AlignHCenter; | - |
1656 | } executed: } Execution Count:22 | 22 |
1657 | | - |
1658 | if (button->features & QStyleOptionButton::HasMenu) partially evaluated: button->features & QStyleOptionButton::HasMenu no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
1659 | ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0); never executed: ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0); | 0 |
1660 | proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), | - |
1661 | button->text, QPalette::ButtonText); | - |
1662 | } executed: } Execution Count:22 | 22 |
1663 | break; executed: break; Execution Count:23 | 23 |
1664 | case CE_MenuBarEmptyArea: | - |
1665 | painter->save(); | - |
1666 | { | - |
1667 | painter->fillRect(rect, option->palette.window()); | - |
1668 | if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) { partially evaluated: widget no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: qobject_cast<const QMainWindow *>(widget->parentWidget()) | 0-1 |
1669 | QColor shadow = mergedColors(option->palette.background().color().darker(120), | - |
1670 | outline.lighter(140), 60); | - |
1671 | painter->setPen(QPen(shadow)); | - |
1672 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - |
1673 | } | 0 |
1674 | } | - |
1675 | painter->restore(); | - |
1676 | break; executed: break; Execution Count:1 | 1 |
1677 | case CE_TabBarTabShape: | - |
1678 | painter->save(); | - |
1679 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { evaluated: const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option) yes Evaluation Count:12 | yes Evaluation Count:1 |
| 1-12 |
1680 | | - |
1681 | bool rtlHorTabs = (tab->direction == Qt::RightToLeft partially evaluated: tab->direction == Qt::RightToLeft no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
1682 | && (tab->shape == QTabBar::RoundedNorth never evaluated: tab->shape == QTabBar::RoundedNorth | 0 |
1683 | || tab->shape == QTabBar::RoundedSouth)); never evaluated: tab->shape == QTabBar::RoundedSouth | 0 |
1684 | bool selected = tab->state & State_Selected; | - |
1685 | bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End) partially evaluated: !rtlHorTabs yes Evaluation Count:12 | no Evaluation Count:0 |
evaluated: tab->position == QStyleOptionTab::End yes Evaluation Count:6 | yes Evaluation Count:6 |
| 0-12 |
1686 | || (rtlHorTabs partially evaluated: rtlHorTabs no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
1687 | && tab->position == QStyleOptionTab::Beginning)); never evaluated: tab->position == QStyleOptionTab::Beginning | 0 |
1688 | bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; | - |
1689 | int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget); | - |
1690 | rect = option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0); | - |
1691 | | - |
1692 | QRect r2(rect); | - |
1693 | int x1 = r2.left(); | - |
1694 | int x2 = r2.right(); | - |
1695 | int y1 = r2.top(); | - |
1696 | int y2 = r2.bottom(); | - |
1697 | | - |
1698 | painter->setPen(d->innerContrastLine()); | - |
1699 | | - |
1700 | QTransform rotMatrix; | - |
1701 | bool flip = false; | - |
1702 | painter->setPen(shadow); | - |
1703 | | - |
1704 | switch (tab->shape) { | - |
1705 | case QTabBar::RoundedNorth: | - |
1706 | break; executed: break; Execution Count:12 | 12 |
1707 | case QTabBar::RoundedSouth: | - |
1708 | rotMatrix.rotate(180); | - |
1709 | rotMatrix.translate(0, -rect.height() + 1); | - |
1710 | rotMatrix.scale(-1, 1); | - |
1711 | painter->setTransform(rotMatrix, true); | - |
1712 | break; | 0 |
1713 | case QTabBar::RoundedWest: | - |
1714 | rotMatrix.rotate(180 + 90); | - |
1715 | rotMatrix.scale(-1, 1); | - |
1716 | flip = true; | - |
1717 | painter->setTransform(rotMatrix, true); | - |
1718 | break; | 0 |
1719 | case QTabBar::RoundedEast: | - |
1720 | rotMatrix.rotate(90); | - |
1721 | rotMatrix.translate(0, - rect.width() + 1); | - |
1722 | flip = true; | - |
1723 | painter->setTransform(rotMatrix, true); | - |
1724 | break; | 0 |
1725 | default: | - |
1726 | painter->restore(); | - |
1727 | QCommonStyle::drawControl(element, tab, painter, widget); | - |
1728 | return; | 0 |
1729 | } | - |
1730 | | - |
1731 | if (flip) { partially evaluated: flip no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
1732 | QRect tmp = rect; | - |
1733 | rect = QRect(tmp.y(), tmp.x(), tmp.height(), tmp.width()); | - |
1734 | int temp = x1; | - |
1735 | x1 = y1; | - |
1736 | y1 = temp; | - |
1737 | temp = x2; | - |
1738 | x2 = y2; | - |
1739 | y2 = temp; | - |
1740 | } | 0 |
1741 | | - |
1742 | painter->setRenderHint(QPainter::Antialiasing, true); | - |
1743 | painter->translate(0.5, 0.5); | - |
1744 | | - |
1745 | QColor tabFrameColor = tab->features & QStyleOptionTab::HasFrame ? partially evaluated: tab->features & QStyleOptionTab::HasFrame yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1746 | d->tabFrameColor(option->palette) : | - |
1747 | option->palette.window().color(); | - |
1748 | | - |
1749 | QLinearGradient fillGradient(rect.topLeft(), rect.bottomLeft()); | - |
1750 | QLinearGradient outlineGradient(rect.topLeft(), rect.bottomLeft()); | - |
1751 | QPen outlinePen = outline.lighter(110); | - |
1752 | if (selected) { evaluated: selected yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
1753 | fillGradient.setColorAt(0, tabFrameColor.lighter(104)); | - |
1754 | fillGradient.setColorAt(1, tabFrameColor); | - |
1755 | outlineGradient.setColorAt(1, outline); | - |
1756 | outlinePen = QPen(outlineGradient, 1); | - |
1757 | } else { executed: } Execution Count:6 | 6 |
1758 | fillGradient.setColorAt(0, tabFrameColor.darker(108)); | - |
1759 | fillGradient.setColorAt(0.85, tabFrameColor.darker(108)); | - |
1760 | fillGradient.setColorAt(1, tabFrameColor.darker(116)); | - |
1761 | } executed: } Execution Count:6 | 6 |
1762 | | - |
1763 | QRect drawRect = rect.adjusted(0, selected ? 0 : 2, 0, 3); | - |
1764 | painter->setPen(outlinePen); | - |
1765 | painter->save(); | - |
1766 | painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3)); | - |
1767 | painter->setBrush(fillGradient); | - |
1768 | painter->drawRoundedRect(drawRect.adjusted(0, 0, -1, -1), 2.0, 2.0); | - |
1769 | painter->setBrush(Qt::NoBrush); | - |
1770 | painter->setPen(d->innerContrastLine()); | - |
1771 | painter->drawRoundedRect(drawRect.adjusted(1, 1, -2, -1), 2.0, 2.0); | - |
1772 | painter->restore(); | - |
1773 | | - |
1774 | if (selected) { evaluated: selected yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
1775 | painter->fillRect(rect.left() + 1, rect.bottom() - 1, rect.width() - 2, rect.bottom() - 1, tabFrameColor); | - |
1776 | painter->fillRect(QRect(rect.bottomRight() + QPoint(-2, -1), QSize(1, 1)), d->innerContrastLine()); | - |
1777 | painter->fillRect(QRect(rect.bottomLeft() + QPoint(0, -1), QSize(1, 1)), d->innerContrastLine()); | - |
1778 | painter->fillRect(QRect(rect.bottomRight() + QPoint(-1, -1), QSize(1, 1)), d->innerContrastLine()); | - |
1779 | } executed: } Execution Count:6 | 6 |
1780 | } executed: } Execution Count:12 | 12 |
1781 | painter->restore(); | - |
1782 | break; executed: break; Execution Count:13 | 13 |
1783 | default: | - |
1784 | QCommonStyle::drawControl(element,option,painter,widget); | - |
1785 | break; executed: break; Execution Count:318 | 318 |
1786 | } | - |
1787 | } executed: } Execution Count:400 | 400 |
1788 | | - |
1789 | | - |
1790 | | - |
1791 | | - |
1792 | QPalette QFusionStyle::standardPalette () const | - |
1793 | { | - |
1794 | QPalette palette = QCommonStyle::standardPalette(); | - |
1795 | palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198)); | - |
1796 | palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(145, 141, 126)); | - |
1797 | palette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 141, 126)); | - |
1798 | | - |
1799 | QColor backGround(239, 235, 231); | - |
1800 | | - |
1801 | QColor light = backGround.lighter(150); | - |
1802 | QColor base = Qt::white; | - |
1803 | QColor dark = QColor(170, 156, 143).darker(110); | - |
1804 | dark = backGround.darker(150); | - |
1805 | QColor darkDisabled = QColor(209, 200, 191).darker(110); | - |
1806 | | - |
1807 | | - |
1808 | palette.setBrush(QPalette::Disabled, QPalette::Text, QColor(190, 190, 190)); | - |
1809 | | - |
1810 | palette.setBrush(QPalette::Window, backGround); | - |
1811 | palette.setBrush(QPalette::Mid, backGround.darker(130)); | - |
1812 | palette.setBrush(QPalette::Light, light); | - |
1813 | | - |
1814 | palette.setBrush(QPalette::Active, QPalette::Base, base); | - |
1815 | palette.setBrush(QPalette::Inactive, QPalette::Base, base); | - |
1816 | palette.setBrush(QPalette::Disabled, QPalette::Base, backGround); | - |
1817 | | - |
1818 | palette.setBrush(QPalette::Midlight, palette.mid().color().lighter(110)); | - |
1819 | | - |
1820 | palette.setBrush(QPalette::All, QPalette::Dark, dark); | - |
1821 | palette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled); | - |
1822 | | - |
1823 | QColor button = backGround; | - |
1824 | | - |
1825 | palette.setBrush(QPalette::Button, button); | - |
1826 | | - |
1827 | QColor shadow = dark.darker(135); | - |
1828 | palette.setBrush(QPalette::Shadow, shadow); | - |
1829 | palette.setBrush(QPalette::Disabled, QPalette::Shadow, shadow.lighter(150)); | - |
1830 | palette.setBrush(QPalette::HighlightedText, QColor(QRgb(0xffffffff))); | - |
1831 | | - |
1832 | return palette; never executed: return palette; | 0 |
1833 | } | - |
1834 | | - |
1835 | | - |
1836 | | - |
1837 | | - |
1838 | void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, | - |
1839 | QPainter *painter, const QWidget *widget) const | - |
1840 | { | - |
1841 | | - |
1842 | const QFusionStylePrivate * const d = d_func(); | - |
1843 | | - |
1844 | QColor buttonColor = d->buttonColor(option->palette); | - |
1845 | QColor gradientStartColor = buttonColor.lighter(118); | - |
1846 | QColor gradientStopColor = buttonColor; | - |
1847 | QColor outline = d->outline(option->palette); | - |
1848 | | - |
1849 | QColor alphaCornerColor; | - |
1850 | if (widget) { evaluated: widget yes Evaluation Count:147 | yes Evaluation Count:8 |
| 8-147 |
1851 | | - |
1852 | alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), outline); | - |
1853 | } else { executed: } Execution Count:147 | 147 |
1854 | alphaCornerColor = mergedColors(option->palette.background().color(), outline); | - |
1855 | } executed: } Execution Count:8 | 8 |
1856 | | - |
1857 | switch (control) { | - |
1858 | case CC_GroupBox: | - |
1859 | painter->save(); | - |
1860 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { partially evaluated: const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1861 | | - |
1862 | QRect textRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxLabel, widget); | - |
1863 | QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget); | - |
1864 | | - |
1865 | if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { partially evaluated: groupBox->subControls & QStyle::SC_GroupBoxFrame yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1866 | QStyleOptionFrame frame; | - |
1867 | frame.QStyleOption::operator=(*groupBox); | - |
1868 | frame.features = groupBox->features; | - |
1869 | frame.lineWidth = groupBox->lineWidth; | - |
1870 | frame.midLineWidth = groupBox->midLineWidth; | - |
1871 | frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); | - |
1872 | proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); | - |
1873 | } executed: } Execution Count:1 | 1 |
1874 | | - |
1875 | | - |
1876 | if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { partially evaluated: (groupBox->subControls & QStyle::SC_GroupBoxLabel) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !groupBox->text.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1877 | | - |
1878 | painter->setPen(QPen(option->palette.windowText(), 1)); | - |
1879 | int alignment = int(groupBox->textAlignment); | - |
1880 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget)) never evaluated: !proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget) | 0 |
1881 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 |
1882 | | - |
1883 | proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignLeft | alignment, | - |
1884 | groupBox->palette, groupBox->state & State_Enabled, groupBox->text, QPalette::NoRole); | - |
1885 | | - |
1886 | if (groupBox->state & State_HasFocus) { never evaluated: groupBox->state & State_HasFocus | 0 |
1887 | QStyleOptionFocusRect fropt; | - |
1888 | fropt.QStyleOption::operator=(*groupBox); | - |
1889 | fropt.rect = textRect.adjusted(-2, -1, 2, 1); | - |
1890 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); | - |
1891 | } | 0 |
1892 | } | 0 |
1893 | | - |
1894 | | - |
1895 | if (groupBox->subControls & SC_GroupBoxCheckBox) { partially evaluated: groupBox->subControls & SC_GroupBoxCheckBox yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1896 | QStyleOptionButton box; | - |
1897 | box.QStyleOption::operator=(*groupBox); | - |
1898 | box.rect = checkBoxRect; | - |
1899 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - |
1900 | } executed: } Execution Count:1 | 1 |
1901 | } executed: } Execution Count:1 | 1 |
1902 | painter->restore(); | - |
1903 | break; executed: break; Execution Count:1 | 1 |
1904 | case CC_SpinBox: | - |
1905 | if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { partially evaluated: const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1906 | QPixmap cache; | - |
1907 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size()); | - |
1908 | if (!QPixmapCache::find(pixmapName, cache)) { partially evaluated: !QPixmapCache::find(pixmapName, cache) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1909 | | - |
1910 | cache = styleCachePixmap(spinBox->rect.size()); | - |
1911 | cache.fill(Qt::transparent); | - |
1912 | | - |
1913 | QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height()); | - |
1914 | QRect rect = pixmapRect; | - |
1915 | QRect r = rect.adjusted(0, 1, 0, -1); | - |
1916 | QPainter cachePainter(&cache); | - |
1917 | QColor arrowColor = spinBox->palette.foreground().color(); | - |
1918 | arrowColor.setAlpha(220); | - |
1919 | | - |
1920 | bool isEnabled = (spinBox->state & State_Enabled); | - |
1921 | bool hover = isEnabled && (spinBox->state & State_MouseOver); partially evaluated: isEnabled yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: (spinBox->state & State_MouseOver) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1922 | bool sunken = (spinBox->state & State_Sunken); | - |
1923 | bool upIsActive = (spinBox->activeSubControls == SC_SpinBoxUp); | - |
1924 | bool downIsActive = (spinBox->activeSubControls == SC_SpinBoxDown); | - |
1925 | bool hasFocus = (option->state & State_HasFocus); | - |
1926 | | - |
1927 | QStyleOptionSpinBox spinBoxCopy = *spinBox; | - |
1928 | spinBoxCopy.rect = pixmapRect; | - |
1929 | QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget); | - |
1930 | QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget); | - |
1931 | | - |
1932 | if (spinBox->frame) { evaluated: spinBox->frame yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1933 | cachePainter.save(); | - |
1934 | cachePainter.setRenderHint(QPainter::Antialiasing, true); | - |
1935 | cachePainter.translate(0.5, 0.5); | - |
1936 | | - |
1937 | | - |
1938 | cachePainter.setPen(Qt::NoPen); | - |
1939 | cachePainter.setBrush(option->palette.base()); | - |
1940 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - |
1941 | | - |
1942 | | - |
1943 | cachePainter.setPen(d->topShadow()); | - |
1944 | cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); | - |
1945 | | - |
1946 | | - |
1947 | QColor buttonColor = d->buttonColor(option->palette); | - |
1948 | QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2); | - |
1949 | QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104)); | - |
1950 | | - |
1951 | | - |
1952 | cachePainter.setPen(Qt::NoPen); | - |
1953 | cachePainter.setBrush(gradient); | - |
1954 | | - |
1955 | cachePainter.save(); | - |
1956 | cachePainter.setClipRect(updownRect); | - |
1957 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - |
1958 | cachePainter.setPen(QPen(d->innerContrastLine())); | - |
1959 | cachePainter.setBrush(Qt::NoBrush); | - |
1960 | cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2); | - |
1961 | cachePainter.restore(); | - |
1962 | | - |
1963 | if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) { partially evaluated: (spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: upIsActive no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1964 | if (sunken) | 0 |
1965 | cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), gradientStopColor.darker(110)); never executed: cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), gradientStopColor.darker(110)); | 0 |
1966 | else if (hover) | 0 |
1967 | cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), d->innerContrastLine()); never executed: cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), d->innerContrastLine()); | 0 |
1968 | } | - |
1969 | | - |
1970 | if ((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) && downIsActive) { partially evaluated: (spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: downIsActive | 0-2 |
1971 | if (sunken) | 0 |
1972 | cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), gradientStopColor.darker(110)); never executed: cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), gradientStopColor.darker(110)); | 0 |
1973 | else if (hover) | 0 |
1974 | cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), d->innerContrastLine()); never executed: cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), d->innerContrastLine()); | 0 |
1975 | } | - |
1976 | | - |
1977 | cachePainter.setPen(hasFocus ? d->highlightedOutline(option->palette) : outline); | - |
1978 | cachePainter.setBrush(Qt::NoBrush); | - |
1979 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - |
1980 | if (hasFocus) { evaluated: hasFocus yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1981 | QColor softHighlight = option->palette.highlight().color(); | - |
1982 | softHighlight.setAlpha(40); | - |
1983 | cachePainter.setPen(softHighlight); | - |
1984 | cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7); | - |
1985 | } executed: } Execution Count:1 | 1 |
1986 | cachePainter.restore(); | - |
1987 | } executed: } Execution Count:2 | 2 |
1988 | | - |
1989 | | - |
1990 | cachePainter.setPen(outline); | - |
1991 | if (spinBox->direction == Qt::RightToLeft) { partially evaluated: spinBox->direction == Qt::RightToLeft no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1992 | cachePainter.drawLine(upRect.right(), upRect.top() - 1, upRect.right(), downRect.bottom() + 1); | - |
1993 | } else { | 0 |
1994 | cachePainter.drawLine(upRect.left(), upRect.top() - 1, upRect.left(), downRect.bottom() + 1); | - |
1995 | } executed: } Execution Count:3 | 3 |
1996 | | - |
1997 | if (upIsActive && sunken) { partially evaluated: upIsActive no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1998 | cachePainter.setPen(gradientStopColor.darker(130)); | - |
1999 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top()); | - |
2000 | cachePainter.drawLine(upRect.left() + 1, upRect.top(), upRect.left() + 1, upRect.bottom()); | - |
2001 | cachePainter.drawLine(upRect.left() + 1, upRect.top() - 1, upRect.right(), upRect.top() - 1); | - |
2002 | } | 0 |
2003 | | - |
2004 | if (downIsActive && sunken) { partially evaluated: downIsActive no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
2005 | cachePainter.setPen(gradientStopColor.darker(130)); | - |
2006 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.left() + 1, downRect.bottom() + 1); | - |
2007 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top()); | - |
2008 | cachePainter.setPen(gradientStopColor.darker(110)); | - |
2009 | cachePainter.drawLine(downRect.left() + 1, downRect.bottom() + 1, downRect.right(), downRect.bottom() + 1); | - |
2010 | } | 0 |
2011 | | - |
2012 | QColor disabledColor = mergedColors(arrowColor, option->palette.button().color()); | - |
2013 | if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) { partially evaluated: spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
2014 | int centerX = upRect.center().x(); | - |
2015 | int centerY = upRect.center().y(); | - |
2016 | | - |
2017 | | - |
2018 | cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor); | - |
2019 | cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY); | - |
2020 | cachePainter.drawLine(centerX + 1, centerY - 2, centerX + 1, centerY + 2); | - |
2021 | | - |
2022 | centerX = downRect.center().x(); | - |
2023 | centerY = downRect.center().y(); | - |
2024 | cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor); | - |
2025 | cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY); | - |
2026 | | - |
2027 | } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows){ partially evaluated: spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
2028 | | - |
2029 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - |
2030 | | - |
2031 | QPixmap upArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), | - |
2032 | (spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor); | - |
2033 | | - |
2034 | QRectF upArrowRect = QRectF(upRect.center().x() - upArrow.width() / 4.0 + 1.0, | - |
2035 | upRect.center().y() - upArrow.height() / 4.0 + 1.0, | - |
2036 | upArrow.width() / 2.0, upArrow.height() / 2.0); | - |
2037 | | - |
2038 | cachePainter.drawPixmap(upArrowRect, upArrow, QRectF(QPointF(0.0, 0.0), upArrow.size())); | - |
2039 | | - |
2040 | QPixmap downArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), | - |
2041 | (spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor, 180); | - |
2042 | QRectF downArrowRect = QRectF(downRect.center().x() - downArrow.width() / 4.0 + 1.0, | - |
2043 | downRect.center().y() - downArrow.height() / 4.0 + 1.0, | - |
2044 | downArrow.width() / 2.0, downArrow.height() / 2.0); | - |
2045 | cachePainter.drawPixmap(downArrowRect, downArrow, QRectF(QPointF(0.0, 0.0), downArrow.size())); | - |
2046 | } executed: } Execution Count:3 | 3 |
2047 | | - |
2048 | cachePainter.end(); | - |
2049 | QPixmapCache::insert(pixmapName, cache); | - |
2050 | } executed: } Execution Count:3 | 3 |
2051 | painter->drawPixmap(spinBox->rect.topLeft(), cache); | - |
2052 | } executed: } Execution Count:3 | 3 |
2053 | break; executed: break; Execution Count:3 | 3 |
2054 | case CC_TitleBar: | - |
2055 | painter->save(); | - |
2056 | if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) { partially evaluated: const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2057 | const int buttonMargin = 5; | - |
2058 | bool active = (titleBar->titleBarState & State_Active); | - |
2059 | QRect fullRect = titleBar->rect; | - |
2060 | QPalette palette = option->palette; | - |
2061 | QColor highlight = option->palette.highlight().color(); | - |
2062 | | - |
2063 | QColor titleBarFrameBorder(active ? highlight.darker(180): outline.darker(110)); | - |
2064 | QColor titleBarHighlight(active ? highlight.lighter(120): palette.background().color().lighter(120)); | - |
2065 | QColor textColor(active ? 0xffffff : 0xff000000); | - |
2066 | QColor textAlphaColor(active ? 0xffffff : 0xff000000 ); | - |
2067 | | - |
2068 | { | - |
2069 | | - |
2070 | QColor titlebarColor = QColor(active ? highlight: palette.background().color()); | - |
2071 | QLinearGradient gradient(option->rect.center().x(), option->rect.top(), | - |
2072 | option->rect.center().x(), option->rect.bottom()); | - |
2073 | | - |
2074 | gradient.setColorAt(0, titlebarColor.lighter(114)); | - |
2075 | gradient.setColorAt(0.5, titlebarColor.lighter(102)); | - |
2076 | gradient.setColorAt(0.51, titlebarColor.darker(104)); | - |
2077 | gradient.setColorAt(1, titlebarColor); | - |
2078 | painter->fillRect(option->rect.adjusted(1, 1, -1, 0), gradient); | - |
2079 | | - |
2080 | | - |
2081 | painter->setPen(titleBarFrameBorder); | - |
2082 | | - |
2083 | | - |
2084 | painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top()); | - |
2085 | painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom()); | - |
2086 | const QPoint points[5] = { | - |
2087 | QPoint(fullRect.left() + 4, fullRect.top() + 1), | - |
2088 | QPoint(fullRect.left() + 3, fullRect.top() + 1), | - |
2089 | QPoint(fullRect.left() + 2, fullRect.top() + 2), | - |
2090 | QPoint(fullRect.left() + 1, fullRect.top() + 3), | - |
2091 | QPoint(fullRect.left() + 1, fullRect.top() + 4) | - |
2092 | }; | - |
2093 | painter->drawPoints(points, 5); | - |
2094 | | - |
2095 | painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom()); | - |
2096 | const QPoint points2[5] = { | - |
2097 | QPoint(fullRect.right() - 3, fullRect.top() + 1), | - |
2098 | QPoint(fullRect.right() - 4, fullRect.top() + 1), | - |
2099 | QPoint(fullRect.right() - 2, fullRect.top() + 2), | - |
2100 | QPoint(fullRect.right() - 1, fullRect.top() + 3), | - |
2101 | QPoint(fullRect.right() - 1, fullRect.top() + 4) | - |
2102 | }; | - |
2103 | painter->drawPoints(points2, 5); | - |
2104 | | - |
2105 | | - |
2106 | painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom()); | - |
2107 | | - |
2108 | | - |
2109 | painter->setPen(titleBarHighlight); | - |
2110 | painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1); | - |
2111 | } | - |
2112 | | - |
2113 | QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); | - |
2114 | painter->setPen(active? (titleBar->palette.text().color().lighter(120)) : | - |
2115 | titleBar->palette.text().color() ); | - |
2116 | | - |
2117 | QString title = painter->fontMetrics().elidedText(titleBar->text, Qt::ElideRight, textRect.width() - 14); | - |
2118 | painter->drawText(textRect.adjusted(1, 1, 1, 1), title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | - |
2119 | painter->setPen(Qt::white); | - |
2120 | if (active) partially evaluated: active no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2121 | painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); never executed: painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | 0 |
2122 | | - |
2123 | if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) && partially evaluated: (titleBar->subControls & SC_TitleBarMinButton) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2124 | !(titleBar->titleBarState& Qt::WindowMinimized)) { never evaluated: !(titleBar->titleBarState& Qt::WindowMinimized) | 0 |
2125 | QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); | - |
2126 | if (minButtonRect.isValid()) { never evaluated: minButtonRect.isValid() | 0 |
2127 | bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarMinButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2128 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarMinButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2129 | qt_fusion_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken); | - |
2130 | QRect minButtonIconRect = minButtonRect.adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin); | - |
2131 | painter->setPen(textColor); | - |
2132 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 3, | - |
2133 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 3); | - |
2134 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 4, | - |
2135 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 4); | - |
2136 | painter->setPen(textAlphaColor); | - |
2137 | painter->drawLine(minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 3, | - |
2138 | minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 4); | - |
2139 | painter->drawLine(minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 3, | - |
2140 | minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 4); | - |
2141 | } | 0 |
2142 | } | 0 |
2143 | | - |
2144 | if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) && partially evaluated: (titleBar->subControls & SC_TitleBarMaxButton) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2145 | !(titleBar->titleBarState & Qt::WindowMaximized)) { never evaluated: !(titleBar->titleBarState & Qt::WindowMaximized) | 0 |
2146 | QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); | - |
2147 | if (maxButtonRect.isValid()) { never evaluated: maxButtonRect.isValid() | 0 |
2148 | bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarMaxButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2149 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarMaxButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2150 | qt_fusion_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken); | - |
2151 | | - |
2152 | QRect maxButtonIconRect = maxButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - |
2153 | | - |
2154 | painter->setPen(textColor); | - |
2155 | painter->drawRect(maxButtonIconRect.adjusted(0, 0, -1, -1)); | - |
2156 | painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1, | - |
2157 | maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1); | - |
2158 | painter->setPen(textAlphaColor); | - |
2159 | const QPoint points[4] = { | - |
2160 | maxButtonIconRect.topLeft(), | - |
2161 | maxButtonIconRect.topRight(), | - |
2162 | maxButtonIconRect.bottomLeft(), | - |
2163 | maxButtonIconRect.bottomRight() | - |
2164 | }; | - |
2165 | painter->drawPoints(points, 4); | - |
2166 | } | 0 |
2167 | } | 0 |
2168 | | - |
2169 | | - |
2170 | if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) { partially evaluated: (titleBar->subControls & SC_TitleBarCloseButton) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (titleBar->titleBarFlags & Qt::WindowSystemMenuHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2171 | QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); | - |
2172 | if (closeButtonRect.isValid()) { never evaluated: closeButtonRect.isValid() | 0 |
2173 | bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarCloseButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2174 | bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarCloseButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2175 | qt_fusion_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken); | - |
2176 | QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - |
2177 | painter->setPen(textAlphaColor); | - |
2178 | const QLine lines[4] = { | - |
2179 | QLine(closeIconRect.left() + 1, closeIconRect.top(), | - |
2180 | closeIconRect.right(), closeIconRect.bottom() - 1), | - |
2181 | QLine(closeIconRect.left(), closeIconRect.top() + 1, | - |
2182 | closeIconRect.right() - 1, closeIconRect.bottom()), | - |
2183 | QLine(closeIconRect.right() - 1, closeIconRect.top(), | - |
2184 | closeIconRect.left(), closeIconRect.bottom() - 1), | - |
2185 | QLine(closeIconRect.right(), closeIconRect.top() + 1, | - |
2186 | closeIconRect.left() + 1, closeIconRect.bottom()) | - |
2187 | }; | - |
2188 | painter->drawLines(lines, 4); | - |
2189 | const QPoint points[4] = { | - |
2190 | closeIconRect.topLeft(), | - |
2191 | closeIconRect.topRight(), | - |
2192 | closeIconRect.bottomLeft(), | - |
2193 | closeIconRect.bottomRight() | - |
2194 | }; | - |
2195 | painter->drawPoints(points, 4); | - |
2196 | | - |
2197 | painter->setPen(textColor); | - |
2198 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1, | - |
2199 | closeIconRect.right() - 1, closeIconRect.bottom() - 1); | - |
2200 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1, | - |
2201 | closeIconRect.right() - 1, closeIconRect.top() + 1); | - |
2202 | } | 0 |
2203 | } | 0 |
2204 | | - |
2205 | | - |
2206 | if ((titleBar->subControls & SC_TitleBarNormalButton) && partially evaluated: (titleBar->subControls & SC_TitleBarNormalButton) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2207 | (((titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) && partially evaluated: (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2208 | (titleBar->titleBarState & Qt::WindowMinimized)) || never evaluated: (titleBar->titleBarState & Qt::WindowMinimized) | 0 |
2209 | ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) && partially evaluated: (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2210 | (titleBar->titleBarState & Qt::WindowMaximized)))) { never evaluated: (titleBar->titleBarState & Qt::WindowMaximized) | 0 |
2211 | QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); | - |
2212 | if (normalButtonRect.isValid()) { never evaluated: normalButtonRect.isValid() | 0 |
2213 | | - |
2214 | bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarNormalButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2215 | bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarNormalButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2216 | QRect normalButtonIconRect = normalButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - |
2217 | qt_fusion_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken); | - |
2218 | | - |
2219 | QRect frontWindowRect = normalButtonIconRect.adjusted(0, 3, -3, 0); | - |
2220 | painter->setPen(textColor); | - |
2221 | painter->drawRect(frontWindowRect.adjusted(0, 0, -1, -1)); | - |
2222 | painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1, | - |
2223 | frontWindowRect.right() - 1, frontWindowRect.top() + 1); | - |
2224 | painter->setPen(textAlphaColor); | - |
2225 | const QPoint points[4] = { | - |
2226 | frontWindowRect.topLeft(), | - |
2227 | frontWindowRect.topRight(), | - |
2228 | frontWindowRect.bottomLeft(), | - |
2229 | frontWindowRect.bottomRight() | - |
2230 | }; | - |
2231 | painter->drawPoints(points, 4); | - |
2232 | | - |
2233 | QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3); | - |
2234 | QRegion clipRegion = backWindowRect; | - |
2235 | clipRegion -= frontWindowRect; | - |
2236 | painter->save(); | - |
2237 | painter->setClipRegion(clipRegion); | - |
2238 | painter->setPen(textColor); | - |
2239 | painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1)); | - |
2240 | painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1, | - |
2241 | backWindowRect.right() - 1, backWindowRect.top() + 1); | - |
2242 | painter->setPen(textAlphaColor); | - |
2243 | const QPoint points2[4] = { | - |
2244 | backWindowRect.topLeft(), | - |
2245 | backWindowRect.topRight(), | - |
2246 | backWindowRect.bottomLeft(), | - |
2247 | backWindowRect.bottomRight() | - |
2248 | }; | - |
2249 | painter->drawPoints(points2, 4); | - |
2250 | painter->restore(); | - |
2251 | } | 0 |
2252 | } | 0 |
2253 | | - |
2254 | | - |
2255 | if (titleBar->subControls & SC_TitleBarContextHelpButton partially evaluated: titleBar->subControls & SC_TitleBarContextHelpButton yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2256 | && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) { partially evaluated: (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2257 | QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); | - |
2258 | if (contextHelpButtonRect.isValid()) { never evaluated: contextHelpButtonRect.isValid() | 0 |
2259 | bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarContextHelpButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2260 | bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarContextHelpButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2261 | qt_fusion_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken); | - |
2262 | QImage image(qt_titlebar_context_help); | - |
2263 | QColor alpha = textColor; | - |
2264 | alpha.setAlpha(128); | - |
2265 | image.setColor(1, textColor.rgba()); | - |
2266 | image.setColor(2, alpha.rgba()); | - |
2267 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - |
2268 | painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image); | - |
2269 | } | 0 |
2270 | } | 0 |
2271 | | - |
2272 | | - |
2273 | if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) { partially evaluated: titleBar->subControls & SC_TitleBarShadeButton yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (titleBar->titleBarFlags & Qt::WindowShadeButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2274 | QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); | - |
2275 | if (shadeButtonRect.isValid()) { never evaluated: shadeButtonRect.isValid() | 0 |
2276 | bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarShadeButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2277 | bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarShadeButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2278 | qt_fusion_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken); | - |
2279 | QPixmap arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), textColor); | - |
2280 | painter->drawPixmap(shadeButtonRect.adjusted(5, 7, -5, -7), arrow); | - |
2281 | } | 0 |
2282 | } | 0 |
2283 | | - |
2284 | | - |
2285 | if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) { partially evaluated: titleBar->subControls & SC_TitleBarUnshadeButton yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (titleBar->titleBarFlags & Qt::WindowShadeButtonHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2286 | QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); | - |
2287 | if (unshadeButtonRect.isValid()) { never evaluated: unshadeButtonRect.isValid() | 0 |
2288 | bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver); never evaluated: (titleBar->activeSubControls & SC_TitleBarUnshadeButton) never evaluated: (titleBar->state & State_MouseOver) | 0 |
2289 | bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken); never evaluated: (titleBar->activeSubControls & SC_TitleBarUnshadeButton) never evaluated: (titleBar->state & State_Sunken) | 0 |
2290 | qt_fusion_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken); | - |
2291 | QPixmap arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), textColor, 180); | - |
2292 | painter->drawPixmap(unshadeButtonRect.adjusted(5, 7, -5, -7), arrow); | - |
2293 | } | 0 |
2294 | } | 0 |
2295 | | - |
2296 | if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) { partially evaluated: (titleBar->subControls & SC_TitleBarSysMenu) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (titleBar->titleBarFlags & Qt::WindowSystemMenuHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2297 | QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); | - |
2298 | if (iconRect.isValid()) { never evaluated: iconRect.isValid() | 0 |
2299 | if (!titleBar->icon.isNull()) { never evaluated: !titleBar->icon.isNull() | 0 |
2300 | titleBar->icon.paint(painter, iconRect); | - |
2301 | } else { | 0 |
2302 | QStyleOption tool(0); | - |
2303 | tool.palette = titleBar->palette; | - |
2304 | QPixmap pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16); | - |
2305 | tool.rect = iconRect; | - |
2306 | painter->save(); | - |
2307 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); | - |
2308 | painter->restore(); | - |
2309 | } | 0 |
2310 | } | - |
2311 | } | 0 |
2312 | } executed: } Execution Count:1 | 1 |
2313 | painter->restore(); | - |
2314 | break; executed: break; Execution Count:1 | 1 |
2315 | case CC_ScrollBar: | - |
2316 | painter->save(); | - |
2317 | if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { partially evaluated: const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option) yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
2318 | bool horizontal = scrollBar->orientation == Qt::Horizontal; | - |
2319 | bool sunken = scrollBar->state & State_Sunken; | - |
2320 | | - |
2321 | QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); | - |
2322 | QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); | - |
2323 | QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); | - |
2324 | QRect scrollBarGroove = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); | - |
2325 | | - |
2326 | QRect rect = option->rect; | - |
2327 | QColor alphaOutline = outline; | - |
2328 | alphaOutline.setAlpha(180); | - |
2329 | | - |
2330 | QColor arrowColor = option->palette.foreground().color(); | - |
2331 | arrowColor.setAlpha(220); | - |
2332 | | - |
2333 | | - |
2334 | if (scrollBar->subControls & SC_ScrollBarGroove) { partially evaluated: scrollBar->subControls & SC_ScrollBarGroove yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
2335 | QLinearGradient gradient(rect.center().x(), rect.top(), | - |
2336 | rect.center().x(), rect.bottom()); | - |
2337 | if (!horizontal) evaluated: !horizontal yes Evaluation Count:96 | yes Evaluation Count:49 |
| 49-96 |
2338 | gradient = QLinearGradient(rect.left(), rect.center().y(), | 96 |
2339 | rect.right(), rect.center().y()); executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); Execution Count:96 | 96 |
2340 | gradient.setColorAt(0, buttonColor.darker(107)); | - |
2341 | gradient.setColorAt(0.1, buttonColor.darker(105)); | - |
2342 | gradient.setColorAt(0.9, buttonColor.darker(105)); | - |
2343 | gradient.setColorAt(1, buttonColor.darker(107)); | - |
2344 | | - |
2345 | painter->fillRect(option->rect, gradient); | - |
2346 | painter->setPen(Qt::NoPen); | - |
2347 | painter->setPen(alphaOutline); | - |
2348 | if (horizontal) evaluated: horizontal yes Evaluation Count:49 | yes Evaluation Count:96 |
| 49-96 |
2349 | painter->drawLine(rect.topLeft(), rect.topRight()); executed: painter->drawLine(rect.topLeft(), rect.topRight()); Execution Count:49 | 49 |
2350 | else | - |
2351 | painter->drawLine(rect.topLeft(), rect.bottomLeft()); executed: painter->drawLine(rect.topLeft(), rect.bottomLeft()); Execution Count:96 | 96 |
2352 | | - |
2353 | QColor subtleEdge = alphaOutline; | - |
2354 | subtleEdge.setAlpha(40); | - |
2355 | painter->setPen(Qt::NoPen); | - |
2356 | painter->setBrush(Qt::NoBrush); | - |
2357 | painter->save(); | - |
2358 | painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3)); | - |
2359 | painter->drawRect(scrollBarGroove.adjusted(1, 0, -1, -1)); | - |
2360 | painter->restore(); | - |
2361 | } executed: } Execution Count:145 | 145 |
2362 | | - |
2363 | QRect pixmapRect = scrollBarSlider; | - |
2364 | QLinearGradient gradient(pixmapRect.center().x(), pixmapRect.top(), | - |
2365 | pixmapRect.center().x(), pixmapRect.bottom()); | - |
2366 | if (!horizontal) evaluated: !horizontal yes Evaluation Count:96 | yes Evaluation Count:49 |
| 49-96 |
2367 | gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), | 96 |
2368 | pixmapRect.right(), pixmapRect.center().y()); executed: gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), pixmapRect.right(), pixmapRect.center().y()); Execution Count:96 | 96 |
2369 | | - |
2370 | QLinearGradient highlightedGradient = gradient; | - |
2371 | | - |
2372 | QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40); | - |
2373 | gradient.setColorAt(0, d->buttonColor(option->palette).lighter(108)); | - |
2374 | gradient.setColorAt(1, d->buttonColor(option->palette)); | - |
2375 | | - |
2376 | highlightedGradient.setColorAt(0, gradientStartColor.darker(102)); | - |
2377 | highlightedGradient.setColorAt(1, gradientStopColor.lighter(102)); | - |
2378 | | - |
2379 | | - |
2380 | if (scrollBar->subControls & SC_ScrollBarSlider) { partially evaluated: scrollBar->subControls & SC_ScrollBarSlider yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
2381 | QRect pixmapRect = scrollBarSlider; | - |
2382 | painter->setPen(QPen(alphaOutline)); | - |
2383 | if (option->state & State_Sunken && scrollBar->activeSubControls & SC_ScrollBarSlider) partially evaluated: option->state & State_Sunken no Evaluation Count:0 | yes Evaluation Count:145 |
never evaluated: scrollBar->activeSubControls & SC_ScrollBarSlider | 0-145 |
2384 | painter->setBrush(midColor2); never executed: painter->setBrush(midColor2); | 0 |
2385 | else if (option->state & State_MouseOver && scrollBar->activeSubControls & SC_ScrollBarSlider) partially evaluated: option->state & State_MouseOver no Evaluation Count:0 | yes Evaluation Count:145 |
never evaluated: scrollBar->activeSubControls & SC_ScrollBarSlider | 0-145 |
2386 | painter->setBrush(highlightedGradient); never executed: painter->setBrush(highlightedGradient); | 0 |
2387 | else | - |
2388 | painter->setBrush(gradient); executed: painter->setBrush(gradient); Execution Count:145 | 145 |
2389 | | - |
2390 | painter->drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : 1, horizontal ? 1 : 0)); | - |
2391 | | - |
2392 | painter->setPen(d->innerContrastLine()); | - |
2393 | painter->drawRect(scrollBarSlider.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, -1, -1)); | - |
2394 | } executed: } Execution Count:145 | 145 |
2395 | | - |
2396 | | - |
2397 | if (scrollBar->subControls & SC_ScrollBarSubLine) { partially evaluated: scrollBar->subControls & SC_ScrollBarSubLine yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
2398 | if ((scrollBar->activeSubControls & SC_ScrollBarSubLine) && sunken) partially evaluated: (scrollBar->activeSubControls & SC_ScrollBarSubLine) no Evaluation Count:0 | yes Evaluation Count:145 |
| 0-145 |
2399 | painter->setBrush(gradientStopColor); never executed: painter->setBrush(gradientStopColor); | 0 |
2400 | else if ((scrollBar->activeSubControls & SC_ScrollBarSubLine)) partially evaluated: (scrollBar->activeSubControls & SC_ScrollBarSubLine) no Evaluation Count:0 | yes Evaluation Count:145 |
| 0-145 |
2401 | painter->setBrush(highlightedGradient); never executed: painter->setBrush(highlightedGradient); | 0 |
2402 | else | - |
2403 | painter->setBrush(gradient); executed: painter->setBrush(gradient); Execution Count:145 | 145 |
2404 | | - |
2405 | painter->setPen(Qt::NoPen); | - |
2406 | painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0)); | - |
2407 | painter->setPen(QPen(alphaOutline)); | - |
2408 | if (option->state & State_Horizontal) { evaluated: option->state & State_Horizontal yes Evaluation Count:48 | yes Evaluation Count:97 |
| 48-97 |
2409 | if (option->direction == Qt::RightToLeft) { partially evaluated: option->direction == Qt::RightToLeft no Evaluation Count:0 | yes Evaluation Count:48 |
| 0-48 |
2410 | pixmapRect.setLeft(scrollBarSubLine.left()); | - |
2411 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - |
2412 | } else { | 0 |
2413 | pixmapRect.setRight(scrollBarSubLine.right()); | - |
2414 | painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - |
2415 | } executed: } Execution Count:48 | 48 |
2416 | } else { | - |
2417 | pixmapRect.setBottom(scrollBarSubLine.bottom()); | - |
2418 | painter->drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight()); | - |
2419 | } executed: } Execution Count:97 | 97 |
2420 | | - |
2421 | painter->setBrush(Qt::NoBrush); | - |
2422 | painter->setPen(d->innerContrastLine()); | - |
2423 | painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0 , horizontal ? -2 : -1, horizontal ? -1 : -2)); | - |
2424 | | - |
2425 | | - |
2426 | int rotation = 0; | - |
2427 | if (option->state & State_Horizontal) evaluated: option->state & State_Horizontal yes Evaluation Count:48 | yes Evaluation Count:97 |
| 48-97 |
2428 | rotation = option->direction == Qt::LeftToRight ? -90 : 90; executed: rotation = option->direction == Qt::LeftToRight ? -90 : 90; Execution Count:48 partially evaluated: option->direction == Qt::LeftToRight yes Evaluation Count:48 | no Evaluation Count:0 |
| 0-48 |
2429 | QRect upRect = scrollBarSubLine.translated(horizontal ? -2 : -1, 0); | - |
2430 | QPixmap arrowPixmap = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - |
2431 | painter->drawPixmap(QRectF(upRect.center().x() - arrowPixmap.width() / 4.0 + 2.0, | - |
2432 | upRect.center().y() - arrowPixmap.height() / 4.0 + 1.0, | - |
2433 | arrowPixmap.width() / 2.0, arrowPixmap.height() / 2.0), | - |
2434 | arrowPixmap, QRectF(QPoint(0.0, 0.0), arrowPixmap.size())); | - |
2435 | } executed: } Execution Count:145 | 145 |
2436 | | - |
2437 | | - |
2438 | if (scrollBar->subControls & SC_ScrollBarAddLine) { partially evaluated: scrollBar->subControls & SC_ScrollBarAddLine yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
2439 | if ((scrollBar->activeSubControls & SC_ScrollBarAddLine) && sunken) partially evaluated: (scrollBar->activeSubControls & SC_ScrollBarAddLine) no Evaluation Count:0 | yes Evaluation Count:145 |
| 0-145 |
2440 | painter->setBrush(gradientStopColor); never executed: painter->setBrush(gradientStopColor); | 0 |
2441 | else if ((scrollBar->activeSubControls & SC_ScrollBarAddLine)) partially evaluated: (scrollBar->activeSubControls & SC_ScrollBarAddLine) no Evaluation Count:0 | yes Evaluation Count:145 |
| 0-145 |
2442 | painter->setBrush(midColor2); never executed: painter->setBrush(midColor2); | 0 |
2443 | else | - |
2444 | painter->setBrush(gradient); executed: painter->setBrush(gradient); Execution Count:145 | 145 |
2445 | | - |
2446 | painter->setPen(Qt::NoPen); | - |
2447 | painter->drawRect(scrollBarAddLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0)); | - |
2448 | painter->setPen(QPen(alphaOutline, 1)); | - |
2449 | if (option->state & State_Horizontal) { evaluated: option->state & State_Horizontal yes Evaluation Count:48 | yes Evaluation Count:97 |
| 48-97 |
2450 | if (option->direction == Qt::LeftToRight) { partially evaluated: option->direction == Qt::LeftToRight yes Evaluation Count:48 | no Evaluation Count:0 |
| 0-48 |
2451 | pixmapRect.setLeft(scrollBarAddLine.left()); | - |
2452 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - |
2453 | } else { executed: } Execution Count:48 | 48 |
2454 | pixmapRect.setRight(scrollBarAddLine.right()); | - |
2455 | painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - |
2456 | } | 0 |
2457 | } else { | - |
2458 | pixmapRect.setTop(scrollBarAddLine.top()); | - |
2459 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.topRight()); | - |
2460 | } executed: } Execution Count:97 | 97 |
2461 | | - |
2462 | painter->setPen(d->innerContrastLine()); | - |
2463 | painter->setBrush(Qt::NoBrush); | - |
2464 | painter->drawRect(scrollBarAddLine.adjusted(1, 1, -1, -1)); | - |
2465 | | - |
2466 | int rotation = 180; | - |
2467 | if (option->state & State_Horizontal) evaluated: option->state & State_Horizontal yes Evaluation Count:48 | yes Evaluation Count:97 |
| 48-97 |
2468 | rotation = option->direction == Qt::LeftToRight ? 90 : -90; executed: rotation = option->direction == Qt::LeftToRight ? 90 : -90; Execution Count:48 partially evaluated: option->direction == Qt::LeftToRight yes Evaluation Count:48 | no Evaluation Count:0 |
| 0-48 |
2469 | QRect downRect = scrollBarAddLine.translated(-1, 1); | - |
2470 | QPixmap arrowPixmap = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - |
2471 | painter->drawPixmap(QRectF(downRect.center().x() - arrowPixmap.width() / 4.0 + 2.0, | - |
2472 | downRect.center().y() - arrowPixmap.height() / 4.0, | - |
2473 | arrowPixmap.width() / 2.0, arrowPixmap.height() / 2.0), | - |
2474 | arrowPixmap, QRectF(QPoint(0.0, 0.0), arrowPixmap.size())); | - |
2475 | } executed: } Execution Count:145 | 145 |
2476 | | - |
2477 | } executed: } Execution Count:145 | 145 |
2478 | painter->restore(); | - |
2479 | break;; executed: break; Execution Count:145 | 145 |
2480 | case CC_ComboBox: | - |
2481 | painter->save(); | - |
2482 | if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { partially evaluated: const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2483 | bool hasFocus = option->state & State_HasFocus && option->state & State_KeyboardFocusChange; partially evaluated: option->state & State_HasFocus no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: option->state & State_KeyboardFocusChange | 0-2 |
2484 | bool sunken = comboBox->state & State_On; | - |
2485 | bool isEnabled = (comboBox->state & State_Enabled); | - |
2486 | QPixmap cache; | - |
2487 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("combobox"), option, comboBox->rect.size()); | - |
2488 | if (sunken) partially evaluated: sunken no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2489 | pixmapName += QLatin1String("-sunken"); never executed: pixmapName += QLatin1String("-sunken"); | 0 |
2490 | if (comboBox->editable) evaluated: comboBox->editable yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2491 | pixmapName += QLatin1String("-editable"); executed: pixmapName += QLatin1String("-editable"); Execution Count:1 | 1 |
2492 | if (isEnabled) partially evaluated: isEnabled yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2493 | pixmapName += QLatin1String("-enabled"); executed: pixmapName += QLatin1String("-enabled"); Execution Count:2 | 2 |
2494 | | - |
2495 | if (!QPixmapCache::find(pixmapName, cache)) { partially evaluated: !QPixmapCache::find(pixmapName, cache) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2496 | cache = styleCachePixmap(comboBox->rect.size()); | - |
2497 | cache.fill(Qt::transparent); | - |
2498 | QPainter cachePainter(&cache); | - |
2499 | QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height()); | - |
2500 | QStyleOptionComboBox comboBoxCopy = *comboBox; | - |
2501 | comboBoxCopy.rect = pixmapRect; | - |
2502 | | - |
2503 | QRect rect = pixmapRect; | - |
2504 | QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, | - |
2505 | SC_ComboBoxArrow, widget); | - |
2506 | | - |
2507 | if (comboBox->editable) { evaluated: comboBox->editable yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2508 | QStyleOptionFrame buttonOption; | - |
2509 | buttonOption.QStyleOption::operator=(*comboBox); | - |
2510 | buttonOption.rect = rect; | - |
2511 | buttonOption.state = (comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus)) | - |
2512 | | State_KeyboardFocusChange; | - |
2513 | | - |
2514 | if (sunken) { partially evaluated: sunken no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2515 | buttonOption.state |= State_Sunken; | - |
2516 | buttonOption.state &= ~State_MouseOver; | - |
2517 | } | 0 |
2518 | | - |
2519 | proxy()->drawPrimitive(PE_FrameLineEdit, &buttonOption, &cachePainter, widget); | - |
2520 | | - |
2521 | | - |
2522 | cachePainter.save(); | - |
2523 | cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0)); | - |
2524 | buttonOption.rect.setLeft(comboBox->direction == Qt::LeftToRight ? | - |
2525 | downArrowRect.left() - 6: downArrowRect.right() + 6); | - |
2526 | proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); | - |
2527 | cachePainter.restore(); | - |
2528 | cachePainter.setPen( QPen(hasFocus ? option->palette.highlight() : outline.lighter(110), 1)); | - |
2529 | | - |
2530 | if (!sunken) { partially evaluated: !sunken yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2531 | int borderSize = 1; | - |
2532 | if (comboBox->direction == Qt::RightToLeft) { partially evaluated: comboBox->direction == Qt::RightToLeft no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2533 | cachePainter.drawLine(QPoint(downArrowRect.right() - 1, downArrowRect.top() + borderSize ), | - |
2534 | QPoint(downArrowRect.right() - 1, downArrowRect.bottom() - borderSize)); | - |
2535 | } else { | 0 |
2536 | cachePainter.drawLine(QPoint(downArrowRect.left() , downArrowRect.top() + borderSize), | - |
2537 | QPoint(downArrowRect.left() , downArrowRect.bottom() - borderSize)); | - |
2538 | } executed: } Execution Count:1 | 1 |
2539 | } else { | - |
2540 | if (comboBox->direction == Qt::RightToLeft) { never evaluated: comboBox->direction == Qt::RightToLeft | 0 |
2541 | cachePainter.drawLine(QPoint(downArrowRect.right(), downArrowRect.top() + 2), | - |
2542 | QPoint(downArrowRect.right(), downArrowRect.bottom() - 2)); | - |
2543 | | - |
2544 | } else { | 0 |
2545 | cachePainter.drawLine(QPoint(downArrowRect.left(), downArrowRect.top() + 2), | - |
2546 | QPoint(downArrowRect.left(), downArrowRect.bottom() - 2)); | - |
2547 | } | 0 |
2548 | } | - |
2549 | } else { | - |
2550 | QStyleOptionButton buttonOption; | - |
2551 | buttonOption.QStyleOption::operator=(*comboBox); | - |
2552 | buttonOption.rect = rect; | - |
2553 | buttonOption.state = comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus | State_KeyboardFocusChange); | - |
2554 | if (sunken) { partially evaluated: sunken no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2555 | buttonOption.state |= State_Sunken; | - |
2556 | buttonOption.state &= ~State_MouseOver; | - |
2557 | } | 0 |
2558 | proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); | - |
2559 | } executed: } Execution Count:1 | 1 |
2560 | if (comboBox->subControls & SC_ComboBoxArrow) { partially evaluated: comboBox->subControls & SC_ComboBoxArrow yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2561 | | - |
2562 | QColor arrowColor = option->palette.buttonText().color(); | - |
2563 | arrowColor.setAlpha(220); | - |
2564 | QPixmap downArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - |
2565 | cachePainter.drawPixmap(QRectF(downArrowRect.center().x() - downArrow.width() / 4.0 + 1.0, | - |
2566 | downArrowRect.center().y() - downArrow.height() / 4.0 + 1.0, | - |
2567 | downArrow.width() / 2.0, downArrow.height() / 2.0), | - |
2568 | downArrow, QRectF(QPointF(0.0, 0.0), downArrow.size())); | - |
2569 | } executed: } Execution Count:2 | 2 |
2570 | cachePainter.end(); | - |
2571 | QPixmapCache::insert(pixmapName, cache); | - |
2572 | } executed: } Execution Count:2 | 2 |
2573 | painter->drawPixmap(comboBox->rect.topLeft(), cache); | - |
2574 | } executed: } Execution Count:2 | 2 |
2575 | painter->restore(); | - |
2576 | break; executed: break; Execution Count:2 | 2 |
2577 | case CC_Slider: | - |
2578 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { partially evaluated: const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2579 | QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); | - |
2580 | QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); | - |
2581 | | - |
2582 | bool horizontal = slider->orientation == Qt::Horizontal; | - |
2583 | bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; | - |
2584 | bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; | - |
2585 | QColor activeHighlight = d->highlight(option->palette); | - |
2586 | QPixmap cache; | - |
2587 | QBrush oldBrush = painter->brush(); | - |
2588 | QPen oldPen = painter->pen(); | - |
2589 | QColor shadowAlpha(Qt::black); | - |
2590 | shadowAlpha.setAlpha(10); | - |
2591 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) partially evaluated: option->state & State_HasFocus no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: option->state & State_KeyboardFocusChange | 0-1 |
2592 | outline = d->highlightedOutline(option->palette); never executed: outline = d->highlightedOutline(option->palette); | 0 |
2593 | | - |
2594 | | - |
2595 | if ((option->subControls & SC_SliderGroove) && groove.isValid()) { partially evaluated: (option->subControls & SC_SliderGroove) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: groove.isValid() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2596 | QColor grooveColor; | - |
2597 | grooveColor.setHsv(buttonColor.hue(), | - |
2598 | qMin(255, (int)(buttonColor.saturation())), | - |
2599 | qMin(255, (int)(buttonColor.value()*0.9))); | - |
2600 | QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_groove"), option, groove.size()); | - |
2601 | QRect pixmapRect(0, 0, groove.width(), groove.height()); | - |
2602 | | - |
2603 | | - |
2604 | if (!QPixmapCache::find(groovePixmapName, cache)) { partially evaluated: !QPixmapCache::find(groovePixmapName, cache) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2605 | cache = styleCachePixmap(pixmapRect.size()); | - |
2606 | cache.fill(Qt::transparent); | - |
2607 | QPainter groovePainter(&cache); | - |
2608 | groovePainter.setRenderHint(QPainter::Antialiasing, true); | - |
2609 | groovePainter.translate(0.5, 0.5); | - |
2610 | QLinearGradient gradient; | - |
2611 | if (horizontal) { partially evaluated: horizontal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2612 | gradient.setStart(pixmapRect.center().x(), pixmapRect.top()); | - |
2613 | gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom()); | - |
2614 | } executed: } Execution Count:1 | 1 |
2615 | else { | - |
2616 | gradient.setStart(pixmapRect.left(), pixmapRect.center().y()); | - |
2617 | gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y()); | - |
2618 | } | 0 |
2619 | groovePainter.setPen(QPen(outline)); | - |
2620 | gradient.setColorAt(0, grooveColor.darker(110)); | - |
2621 | gradient.setColorAt(1, grooveColor.lighter(110)); | - |
2622 | groovePainter.setBrush(gradient); | - |
2623 | groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1); | - |
2624 | groovePainter.end(); | - |
2625 | QPixmapCache::insert(groovePixmapName, cache); | - |
2626 | } executed: } Execution Count:1 | 1 |
2627 | painter->drawPixmap(groove.topLeft(), cache); | - |
2628 | | - |
2629 | | - |
2630 | QRect clipRect; | - |
2631 | groovePixmapName += QLatin1String("_blue"); | - |
2632 | if (!QPixmapCache::find(groovePixmapName, cache)) { partially evaluated: !QPixmapCache::find(groovePixmapName, cache) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2633 | cache = styleCachePixmap(pixmapRect.size()); | - |
2634 | cache.fill(Qt::transparent); | - |
2635 | QPainter groovePainter(&cache); | - |
2636 | QLinearGradient gradient; | - |
2637 | if (horizontal) { partially evaluated: horizontal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2638 | gradient.setStart(pixmapRect.center().x(), pixmapRect.top()); | - |
2639 | gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom()); | - |
2640 | } executed: } Execution Count:1 | 1 |
2641 | else { | - |
2642 | gradient.setStart(pixmapRect.left(), pixmapRect.center().y()); | - |
2643 | gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y()); | - |
2644 | } | 0 |
2645 | QColor highlight = d->highlight(option->palette); | - |
2646 | QColor highlightedoutline = highlight.darker(140); | - |
2647 | if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb())) partially evaluated: qGray(outline.rgb()) > qGray(highlightedoutline.rgb()) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2648 | outline = highlightedoutline; executed: outline = highlightedoutline; Execution Count:1 | 1 |
2649 | | - |
2650 | | - |
2651 | groovePainter.setRenderHint(QPainter::Antialiasing, true); | - |
2652 | groovePainter.translate(0.5, 0.5); | - |
2653 | groovePainter.setPen(QPen(outline)); | - |
2654 | gradient.setColorAt(0, activeHighlight); | - |
2655 | gradient.setColorAt(1, activeHighlight.lighter(130)); | - |
2656 | groovePainter.setBrush(gradient); | - |
2657 | groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1); | - |
2658 | groovePainter.setPen(d->innerContrastLine()); | - |
2659 | groovePainter.setBrush(Qt::NoBrush); | - |
2660 | groovePainter.drawRoundedRect(pixmapRect.adjusted(2, 2, -3, -3), 1, 1); | - |
2661 | groovePainter.end(); | - |
2662 | QPixmapCache::insert(groovePixmapName, cache); | - |
2663 | } executed: } Execution Count:1 | 1 |
2664 | if (horizontal) { partially evaluated: horizontal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2665 | if (slider->upsideDown) partially evaluated: slider->upsideDown no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2666 | clipRect = QRect(handle.right(), groove.top(), groove.right() - handle.right(), groove.height()); never executed: clipRect = QRect(handle.right(), groove.top(), groove.right() - handle.right(), groove.height()); | 0 |
2667 | else | - |
2668 | clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height()); executed: clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height()); Execution Count:1 | 1 |
2669 | } else { | - |
2670 | if (slider->upsideDown) never evaluated: slider->upsideDown | 0 |
2671 | clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - handle.bottom()); never executed: clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - handle.bottom()); | 0 |
2672 | else | - |
2673 | clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top()); never executed: clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top()); | 0 |
2674 | } | - |
2675 | painter->save(); | - |
2676 | painter->setClipRect(clipRect.adjusted(0, 0, 1, 1)); | - |
2677 | painter->drawPixmap(groove.topLeft(), cache); | - |
2678 | painter->restore(); | - |
2679 | } executed: } Execution Count:1 | 1 |
2680 | | - |
2681 | | - |
2682 | if ((option->subControls & SC_SliderHandle) ) { partially evaluated: (option->subControls & SC_SliderHandle) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2683 | QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size()); | - |
2684 | if (!QPixmapCache::find(handlePixmapName, cache)) { partially evaluated: !QPixmapCache::find(handlePixmapName, cache) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2685 | cache = styleCachePixmap(handle.size()); | - |
2686 | cache.fill(Qt::transparent); | - |
2687 | QRect pixmapRect(0, 0, handle.width(), handle.height()); | - |
2688 | QPainter handlePainter(&cache); | - |
2689 | QRect gradRect = pixmapRect.adjusted(2, 2, -2, -2); | - |
2690 | | - |
2691 | | - |
2692 | QRect r = pixmapRect.adjusted(1, 1, -2, -2); | - |
2693 | QLinearGradient gradient = qt_fusion_gradient(gradRect, d->buttonColor(option->palette),horizontal ? TopDown : FromLeft); | - |
2694 | | - |
2695 | handlePainter.setRenderHint(QPainter::Antialiasing, true); | - |
2696 | handlePainter.translate(0.5, 0.5); | - |
2697 | | - |
2698 | handlePainter.setPen(Qt::NoPen); | - |
2699 | handlePainter.setBrush(QColor(0, 0, 0, 40)); | - |
2700 | handlePainter.drawRect(r.adjusted(-1, 2, 1, -2)); | - |
2701 | | - |
2702 | handlePainter.setPen(QPen(d->outline(option->palette))); | - |
2703 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) partially evaluated: option->state & State_HasFocus no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: option->state & State_KeyboardFocusChange | 0-1 |
2704 | handlePainter.setPen(QPen(d->highlightedOutline(option->palette))); never executed: handlePainter.setPen(QPen(d->highlightedOutline(option->palette))); | 0 |
2705 | | - |
2706 | handlePainter.setBrush(gradient); | - |
2707 | handlePainter.drawRoundedRect(r, 2, 2); | - |
2708 | handlePainter.setBrush(Qt::NoBrush); | - |
2709 | handlePainter.setPen(d->innerContrastLine()); | - |
2710 | handlePainter.drawRoundedRect(r.adjusted(1, 1, -1, -1), 2, 2); | - |
2711 | | - |
2712 | QColor cornerAlpha = outline.darker(120); | - |
2713 | cornerAlpha.setAlpha(80); | - |
2714 | | - |
2715 | | - |
2716 | handlePainter.setPen(shadowAlpha); | - |
2717 | handlePainter.drawLine(QPoint(r.left() + 2, r.bottom() + 1), QPoint(r.right() - 2, r.bottom() + 1)); | - |
2718 | handlePainter.drawLine(QPoint(r.right() + 1, r.bottom() - 3), QPoint(r.right() + 1, r.top() + 4)); | - |
2719 | handlePainter.drawLine(QPoint(r.right() - 1, r.bottom()), QPoint(r.right() + 1, r.bottom() - 2)); | - |
2720 | | - |
2721 | handlePainter.end(); | - |
2722 | QPixmapCache::insert(handlePixmapName, cache); | - |
2723 | } executed: } Execution Count:1 | 1 |
2724 | | - |
2725 | painter->drawPixmap(handle.topLeft(), cache); | - |
2726 | | - |
2727 | } executed: } Execution Count:1 | 1 |
2728 | if (option->subControls & SC_SliderTickmarks) { partially evaluated: option->subControls & SC_SliderTickmarks yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2729 | painter->setPen(outline); | - |
2730 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - |
2731 | int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); | - |
2732 | int interval = slider->tickInterval; | - |
2733 | if (interval <= 0) { partially evaluated: interval <= 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2734 | interval = slider->singleStep; | - |
2735 | if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval, | 0 |
2736 | available) | 0 |
2737 | - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, | 0 |
2738 | 0, available) < 3) never evaluated: QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval, available) - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, 0, available) < 3 | 0 |
2739 | interval = slider->pageStep; never executed: interval = slider->pageStep; | 0 |
2740 | } | 0 |
2741 | if (interval <= 0) partially evaluated: interval <= 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2742 | interval = 1; never executed: interval = 1; | 0 |
2743 | | - |
2744 | int v = slider->minimum; | - |
2745 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - |
2746 | while (v <= slider->maximum + 1) { evaluated: v <= slider->maximum + 1 yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
2747 | if (v == slider->maximum + 1 && interval == 1) partially evaluated: v == slider->maximum + 1 no Evaluation Count:0 | yes Evaluation Count:5 |
never evaluated: interval == 1 | 0-5 |
2748 | break; | 0 |
2749 | const int v_ = qMin(v, slider->maximum); | - |
2750 | int pos = sliderPositionFromValue(slider->minimum, slider->maximum, | - |
2751 | v_, (horizontal | - |
2752 | ? slider->rect.width() | - |
2753 | : slider->rect.height()) - len, | - |
2754 | slider->upsideDown) + len / 2; | - |
2755 | int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0); evaluated: v_ == slider->minimum yes Evaluation Count:1 | yes Evaluation Count:4 |
evaluated: v_ == slider->maximum yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-4 |
2756 | | - |
2757 | if (horizontal) { partially evaluated: horizontal yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2758 | if (ticksAbove) { partially evaluated: ticksAbove no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2759 | painter->drawLine(pos, slider->rect.top() + extra, | - |
2760 | pos, slider->rect.top() + tickSize); | - |
2761 | } | 0 |
2762 | if (ticksBelow) { partially evaluated: ticksBelow no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2763 | painter->drawLine(pos, slider->rect.bottom() - extra, | - |
2764 | pos, slider->rect.bottom() - tickSize); | - |
2765 | } | 0 |
2766 | } else { executed: } Execution Count:5 | 5 |
2767 | if (ticksAbove) { never evaluated: ticksAbove | 0 |
2768 | painter->drawLine(slider->rect.left() + extra, pos, | - |
2769 | slider->rect.left() + tickSize, pos); | - |
2770 | } | 0 |
2771 | if (ticksBelow) { never evaluated: ticksBelow | 0 |
2772 | painter->drawLine(slider->rect.right() - extra, pos, | - |
2773 | slider->rect.right() - tickSize, pos); | - |
2774 | } | 0 |
2775 | } | 0 |
2776 | | - |
2777 | int nextInterval = v + interval; | - |
2778 | if (nextInterval < v) partially evaluated: nextInterval < v no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2779 | break; | 0 |
2780 | v = nextInterval; | - |
2781 | } executed: } Execution Count:5 | 5 |
2782 | } executed: } Execution Count:1 | 1 |
2783 | painter->setBrush(oldBrush); | - |
2784 | painter->setPen(oldPen); | - |
2785 | } executed: } Execution Count:1 | 1 |
2786 | break; executed: break; Execution Count:1 | 1 |
2787 | case CC_Dial: | - |
2788 | if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option)) partially evaluated: const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2789 | QStyleHelper::drawDial(dial, painter); executed: QStyleHelper::drawDial(dial, painter); Execution Count:1 | 1 |
2790 | break; executed: break; Execution Count:1 | 1 |
2791 | default: | - |
2792 | QCommonStyle::drawComplexControl(control, option, painter, widget); | - |
2793 | break; executed: break; Execution Count:1 | 1 |
2794 | } | - |
2795 | } executed: } Execution Count:155 | 155 |
2796 | | - |
2797 | | - |
2798 | | - |
2799 | | - |
2800 | int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const | - |
2801 | { | - |
2802 | switch (metric) { | - |
2803 | case PM_HeaderMargin: | - |
2804 | return 2; executed: return 2; Execution Count:2 | 2 |
2805 | case PM_ToolTipLabelFrameWidth: | - |
2806 | return 2; executed: return 2; Execution Count:2 | 2 |
2807 | case PM_ButtonDefaultIndicator: | - |
2808 | return 0; executed: return 0; Execution Count:56 | 56 |
2809 | case PM_ButtonShiftHorizontal: | - |
2810 | case PM_ButtonShiftVertical: | - |
2811 | return 0; executed: return 0; Execution Count:4 | 4 |
2812 | case PM_MessageBoxIconSize: | - |
2813 | return 48; executed: return 48; Execution Count:2 | 2 |
2814 | case PM_ListViewIconSize: | - |
2815 | return 24; executed: return 24; Execution Count:2 | 2 |
2816 | case PM_DialogButtonsSeparator: | - |
2817 | case PM_ScrollBarSliderMin: | - |
2818 | return 26; executed: return 26; Execution Count:2460 | 2460 |
2819 | case PM_TitleBarHeight: | - |
2820 | return 24; executed: return 24; Execution Count:2 | 2 |
2821 | case PM_ScrollBarExtent: | - |
2822 | return 14; executed: return 14; Execution Count:3806 | 3806 |
2823 | case PM_SliderThickness: | - |
2824 | return 15; executed: return 15; Execution Count:3 | 3 |
2825 | case PM_SliderLength: | - |
2826 | return 15; executed: return 15; Execution Count:6 | 6 |
2827 | case PM_DockWidgetTitleMargin: | - |
2828 | return 1; executed: return 1; Execution Count:2 | 2 |
2829 | case PM_DefaultFrameWidth: | - |
2830 | return 1; executed: return 1; Execution Count:1989 | 1989 |
2831 | case PM_SpinBoxFrameWidth: | - |
2832 | return 3; executed: return 3; Execution Count:18 | 18 |
2833 | case PM_MenuVMargin: | - |
2834 | case PM_MenuHMargin: | - |
2835 | return 0; executed: return 0; Execution Count:4 | 4 |
2836 | case PM_MenuPanelWidth: | - |
2837 | return 0; executed: return 0; Execution Count:2 | 2 |
2838 | case PM_MenuBarItemSpacing: | - |
2839 | return 6; executed: return 6; Execution Count:2 | 2 |
2840 | case PM_MenuBarVMargin: | - |
2841 | return 0; executed: return 0; Execution Count:2 | 2 |
2842 | case PM_MenuBarHMargin: | - |
2843 | return 0; executed: return 0; Execution Count:2 | 2 |
2844 | case PM_MenuBarPanelWidth: | - |
2845 | return 0; executed: return 0; Execution Count:2 | 2 |
2846 | case PM_ToolBarHandleExtent: | - |
2847 | return 9; executed: return 9; Execution Count:2 | 2 |
2848 | case PM_ToolBarItemSpacing: | - |
2849 | return 1; executed: return 1; Execution Count:2 | 2 |
2850 | case PM_ToolBarFrameWidth: | - |
2851 | return 2; executed: return 2; Execution Count:2 | 2 |
2852 | case PM_ToolBarItemMargin: | - |
2853 | return 2; executed: return 2; Execution Count:2 | 2 |
2854 | case PM_SmallIconSize: | - |
2855 | return 16; executed: return 16; Execution Count:51 | 51 |
2856 | case PM_ButtonIconSize: | - |
2857 | return 16; executed: return 16; Execution Count:53 | 53 |
2858 | case PM_DockWidgetTitleBarButtonMargin: | - |
2859 | return 2; executed: return 2; Execution Count:2 | 2 |
2860 | case PM_MaximumDragDistance: | - |
2861 | return -1; executed: return -1; Execution Count:2 | 2 |
2862 | case PM_TabCloseIndicatorWidth: | - |
2863 | case PM_TabCloseIndicatorHeight: | - |
2864 | return 20; never executed: return 20; | 0 |
2865 | case PM_TabBarTabVSpace: | - |
2866 | return 12; executed: return 12; Execution Count:80 | 80 |
2867 | case PM_TabBarTabOverlap: | - |
2868 | return 1; executed: return 1; Execution Count:14 | 14 |
2869 | case PM_TabBarBaseOverlap: | - |
2870 | return 2; executed: return 2; Execution Count:36 | 36 |
2871 | case PM_SubMenuOverlap: | - |
2872 | return -1; never executed: return -1; | 0 |
2873 | case PM_DockWidgetHandleExtent: | - |
2874 | case PM_SplitterWidth: | - |
2875 | return 4; executed: return 4; Execution Count:4 | 4 |
2876 | case PM_IndicatorHeight: | - |
2877 | case PM_IndicatorWidth: | - |
2878 | case PM_ExclusiveIndicatorHeight: | - |
2879 | case PM_ExclusiveIndicatorWidth: | - |
2880 | return 14; executed: return 14; Execution Count:16 | 16 |
2881 | case PM_ScrollView_ScrollBarSpacing: | - |
2882 | return 0; never executed: return 0; | 0 |
2883 | default: | - |
2884 | break; executed: break; Execution Count:1376 | 1376 |
2885 | } | - |
2886 | return QCommonStyle::pixelMetric(metric, option, widget); executed: return QCommonStyle::pixelMetric(metric, option, widget); Execution Count:1376 | 1376 |
2887 | } | - |
2888 | | - |
2889 | | - |
2890 | | - |
2891 | | - |
2892 | QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *option, | - |
2893 | const QSize &size, const QWidget *widget) const | - |
2894 | { | - |
2895 | QSize newSize = QCommonStyle::sizeFromContents(type, option, size, widget); | - |
2896 | switch (type) { | - |
2897 | case CT_PushButton: | - |
2898 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { partially evaluated: const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option) yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
2899 | if (!btn->text.isEmpty() && newSize.width() < 80) partially evaluated: !btn->text.isEmpty() yes Evaluation Count:15 | no Evaluation Count:0 |
evaluated: newSize.width() < 80 yes Evaluation Count:14 | yes Evaluation Count:1 |
| 0-15 |
2900 | newSize.setWidth(80); executed: newSize.setWidth(80); Execution Count:14 | 14 |
2901 | if (!btn->icon.isNull() && btn->iconSize.height() > 16) partially evaluated: !btn->icon.isNull() no Evaluation Count:0 | yes Evaluation Count:15 |
never evaluated: btn->iconSize.height() > 16 | 0-15 |
2902 | newSize -= QSize(0, 2); never executed: newSize -= QSize(0, 2); | 0 |
2903 | } executed: } Execution Count:15 | 15 |
2904 | break; executed: break; Execution Count:15 | 15 |
2905 | case CT_GroupBox: | - |
2906 | if (option) { | 0 |
2907 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - |
2908 | newSize += QSize(10, topMargin); | - |
2909 | } | 0 |
2910 | break; | 0 |
2911 | case CT_RadioButton: | - |
2912 | case CT_CheckBox: | - |
2913 | newSize += QSize(0, 1); | - |
2914 | break; | 0 |
2915 | case CT_ToolButton: | - |
2916 | newSize += QSize(2, 2); | - |
2917 | break; executed: break; Execution Count:2 | 2 |
2918 | case CT_SpinBox: | - |
2919 | newSize += QSize(0, -3); | - |
2920 | break; executed: break; Execution Count:2 | 2 |
2921 | case CT_ComboBox: | - |
2922 | newSize += QSize(2, 4); | - |
2923 | break; executed: break; Execution Count:3 | 3 |
2924 | case CT_LineEdit: | - |
2925 | newSize += QSize(0, 4); | - |
2926 | break; executed: break; Execution Count:4 | 4 |
2927 | case CT_MenuBarItem: | - |
2928 | newSize += QSize(8, 5); | - |
2929 | break; | 0 |
2930 | case CT_MenuItem: | - |
2931 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { never evaluated: const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option) | 0 |
2932 | int w = newSize.width(); | - |
2933 | int maxpmw = menuItem->maxIconWidth; | - |
2934 | int tabSpacing = 20; | - |
2935 | if (menuItem->text.contains(QLatin1Char('\t'))) never evaluated: menuItem->text.contains(QLatin1Char('\t')) | 0 |
2936 | w += tabSpacing; never executed: w += tabSpacing; | 0 |
2937 | else if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) never evaluated: menuItem->menuItemType == QStyleOptionMenuItem::SubMenu | 0 |
2938 | w += 2 * QFusionStylePrivate::menuArrowHMargin; never executed: w += 2 * QFusionStylePrivate::menuArrowHMargin; | 0 |
2939 | else if (menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem) { never evaluated: menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem | 0 |
2940 | QFontMetrics fm(menuItem->font); | - |
2941 | QFont fontBold = menuItem->font; | - |
2942 | fontBold.setBold(true); | - |
2943 | QFontMetrics fmBold(fontBold); | - |
2944 | w += fmBold.width(menuItem->text) - fm.width(menuItem->text); | - |
2945 | } | 0 |
2946 | int checkcol = qMax<int>(maxpmw, QFusionStylePrivate::menuCheckMarkWidth); | - |
2947 | w += checkcol; | - |
2948 | w += int(QFusionStylePrivate::menuRightBorder) + 10; | - |
2949 | newSize.setWidth(w); | - |
2950 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { never evaluated: menuItem->menuItemType == QStyleOptionMenuItem::Separator | 0 |
2951 | if (!menuItem->text.isEmpty()) { never evaluated: !menuItem->text.isEmpty() | 0 |
2952 | newSize.setHeight(menuItem->fontMetrics.height()); | - |
2953 | } | 0 |
2954 | } | 0 |
2955 | else if (!menuItem->icon.isNull()) { never evaluated: !menuItem->icon.isNull() | 0 |
2956 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) { never evaluated: const QComboBox *combo = qobject_cast<const QComboBox*>(widget) | 0 |
2957 | newSize.setHeight(qMax(combo->iconSize().height() + 2, newSize.height())); | - |
2958 | } | 0 |
2959 | } | 0 |
2960 | newSize.setWidth(newSize.width() + 12); | - |
2961 | newSize.setWidth(qMax(newSize.width(), 120)); | - |
2962 | } | 0 |
2963 | break; | 0 |
2964 | case CT_SizeGrip: | - |
2965 | newSize += QSize(4, 4); | - |
2966 | break; | 0 |
2967 | case CT_MdiControls: | - |
2968 | if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) { never evaluated: const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option) | 0 |
2969 | int width = 0; | - |
2970 | if (styleOpt->subControls & SC_MdiMinButton) never evaluated: styleOpt->subControls & SC_MdiMinButton | 0 |
2971 | width += 19 + 1; never executed: width += 19 + 1; | 0 |
2972 | if (styleOpt->subControls & SC_MdiNormalButton) never evaluated: styleOpt->subControls & SC_MdiNormalButton | 0 |
2973 | width += 19 + 1; never executed: width += 19 + 1; | 0 |
2974 | if (styleOpt->subControls & SC_MdiCloseButton) never evaluated: styleOpt->subControls & SC_MdiCloseButton | 0 |
2975 | width += 19 + 1; never executed: width += 19 + 1; | 0 |
2976 | newSize = QSize(width, 19); | - |
2977 | } else { | 0 |
2978 | newSize = QSize(60, 19); | - |
2979 | } | 0 |
2980 | break; | 0 |
2981 | default: | - |
2982 | break; executed: break; Execution Count:2481 | 2481 |
2983 | } | - |
2984 | return newSize; executed: return newSize; Execution Count:2507 | 2507 |
2985 | } | - |
2986 | | - |
2987 | | - |
2988 | | - |
2989 | | - |
2990 | void QFusionStyle::polish(QApplication *app) | - |
2991 | { | - |
2992 | QCommonStyle::polish(app); | - |
2993 | } executed: } Execution Count:1 | 1 |
2994 | | - |
2995 | | - |
2996 | | - |
2997 | | - |
2998 | void QFusionStyle::polish(QWidget *widget) | - |
2999 | { | - |
3000 | QCommonStyle::polish(widget); | - |
3001 | if (qobject_cast<QAbstractButton*>(widget) evaluated: qobject_cast<QAbstractButton*>(widget) yes Evaluation Count:16 | yes Evaluation Count:1184 |
| 16-1184 |
3002 | || qobject_cast<QComboBox *>(widget) evaluated: qobject_cast<QComboBox *>(widget) yes Evaluation Count:1 | yes Evaluation Count:1183 |
| 1-1183 |
3003 | || qobject_cast<QProgressBar *>(widget) evaluated: qobject_cast<QProgressBar *>(widget) yes Evaluation Count:3 | yes Evaluation Count:1180 |
| 3-1180 |
3004 | || qobject_cast<QScrollBar *>(widget) evaluated: qobject_cast<QScrollBar *>(widget) yes Evaluation Count:386 | yes Evaluation Count:794 |
| 386-794 |
3005 | || qobject_cast<QSplitterHandle *>(widget) partially evaluated: qobject_cast<QSplitterHandle *>(widget) no Evaluation Count:0 | yes Evaluation Count:794 |
| 0-794 |
3006 | || qobject_cast<QAbstractSlider *>(widget) partially evaluated: qobject_cast<QAbstractSlider *>(widget) no Evaluation Count:0 | yes Evaluation Count:794 |
| 0-794 |
3007 | || qobject_cast<QAbstractSpinBox *>(widget) evaluated: qobject_cast<QAbstractSpinBox *>(widget) yes Evaluation Count:1 | yes Evaluation Count:793 |
| 1-793 |
3008 | || (widget->inherits("QDockSeparator")) partially evaluated: (widget->inherits("QDockSeparator")) no Evaluation Count:0 | yes Evaluation Count:793 |
| 0-793 |
3009 | || (widget->inherits("QDockWidgetSeparator")) partially evaluated: (widget->inherits("QDockWidgetSeparator")) no Evaluation Count:0 | yes Evaluation Count:793 |
| 0-793 |
3010 | ) { | - |
3011 | widget->setAttribute(Qt::WA_Hover, true); | - |
3012 | } executed: } Execution Count:407 | 407 |
3013 | } executed: } Execution Count:1200 | 1200 |
3014 | | - |
3015 | | - |
3016 | | - |
3017 | | - |
3018 | void QFusionStyle::polish(QPalette &pal) | - |
3019 | { | - |
3020 | QCommonStyle::polish(pal); | - |
3021 | } executed: } Execution Count:1 | 1 |
3022 | | - |
3023 | | - |
3024 | | - |
3025 | | - |
3026 | void QFusionStyle::unpolish(QWidget *widget) | - |
3027 | { | - |
3028 | QCommonStyle::unpolish(widget); | - |
3029 | if (qobject_cast<QAbstractButton*>(widget) partially evaluated: qobject_cast<QAbstractButton*>(widget) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3030 | || qobject_cast<QComboBox *>(widget) partially evaluated: qobject_cast<QComboBox *>(widget) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3031 | || qobject_cast<QProgressBar *>(widget) partially evaluated: qobject_cast<QProgressBar *>(widget) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3032 | || qobject_cast<QScrollBar *>(widget) never evaluated: qobject_cast<QScrollBar *>(widget) | 0 |
3033 | || qobject_cast<QSplitterHandle *>(widget) never evaluated: qobject_cast<QSplitterHandle *>(widget) | 0 |
3034 | || qobject_cast<QAbstractSlider *>(widget) never evaluated: qobject_cast<QAbstractSlider *>(widget) | 0 |
3035 | || qobject_cast<QAbstractSpinBox *>(widget) never evaluated: qobject_cast<QAbstractSpinBox *>(widget) | 0 |
3036 | || (widget->inherits("QDockSeparator")) never evaluated: (widget->inherits("QDockSeparator")) | 0 |
3037 | || (widget->inherits("QDockWidgetSeparator")) never evaluated: (widget->inherits("QDockWidgetSeparator")) | 0 |
3038 | ) { | - |
3039 | widget->setAttribute(Qt::WA_Hover, false); | - |
3040 | } executed: } Execution Count:1 | 1 |
3041 | } executed: } Execution Count:1 | 1 |
3042 | | - |
3043 | | - |
3044 | | - |
3045 | | - |
3046 | void QFusionStyle::unpolish(QApplication *app) | - |
3047 | { | - |
3048 | QCommonStyle::unpolish(app); | - |
3049 | } | 0 |
3050 | | - |
3051 | | - |
3052 | | - |
3053 | | - |
3054 | QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, | - |
3055 | SubControl subControl, const QWidget *widget) const | - |
3056 | { | - |
3057 | QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); | - |
3058 | | - |
3059 | switch (control) { | - |
3060 | case CC_Slider: | - |
3061 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { partially evaluated: const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
3062 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - |
3063 | switch (subControl) { | - |
3064 | case SC_SliderHandle: { | - |
3065 | if (slider->orientation == Qt::Horizontal) { partially evaluated: slider->orientation == Qt::Horizontal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3066 | rect.setHeight(proxy()->pixelMetric(PM_SliderThickness)); | - |
3067 | rect.setWidth(proxy()->pixelMetric(PM_SliderLength)); | - |
3068 | int centerY = slider->rect.center().y() - rect.height() / 2; | - |
3069 | if (slider->tickPosition & QSlider::TicksAbove) partially evaluated: slider->tickPosition & QSlider::TicksAbove no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3070 | centerY += tickSize; never executed: centerY += tickSize; | 0 |
3071 | if (slider->tickPosition & QSlider::TicksBelow) partially evaluated: slider->tickPosition & QSlider::TicksBelow no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3072 | centerY -= tickSize; never executed: centerY -= tickSize; | 0 |
3073 | rect.moveTop(centerY); | - |
3074 | } else { executed: } Execution Count:1 | 1 |
3075 | rect.setWidth(proxy()->pixelMetric(PM_SliderThickness)); | - |
3076 | rect.setHeight(proxy()->pixelMetric(PM_SliderLength)); | - |
3077 | int centerX = slider->rect.center().x() - rect.width() / 2; | - |
3078 | if (slider->tickPosition & QSlider::TicksAbove) never evaluated: slider->tickPosition & QSlider::TicksAbove | 0 |
3079 | centerX += tickSize; never executed: centerX += tickSize; | 0 |
3080 | if (slider->tickPosition & QSlider::TicksBelow) never evaluated: slider->tickPosition & QSlider::TicksBelow | 0 |
3081 | centerX -= tickSize; never executed: centerX -= tickSize; | 0 |
3082 | rect.moveLeft(centerX); | - |
3083 | } | 0 |
3084 | } | - |
3085 | break; executed: break; Execution Count:1 | 1 |
3086 | case SC_SliderGroove: { | - |
3087 | QPoint grooveCenter = slider->rect.center(); | - |
3088 | if (slider->orientation == Qt::Horizontal) { partially evaluated: slider->orientation == Qt::Horizontal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3089 | rect.setHeight(7); | - |
3090 | if (slider->tickPosition & QSlider::TicksAbove) partially evaluated: slider->tickPosition & QSlider::TicksAbove no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3091 | grooveCenter.ry() += tickSize; never executed: grooveCenter.ry() += tickSize; | 0 |
3092 | if (slider->tickPosition & QSlider::TicksBelow) partially evaluated: slider->tickPosition & QSlider::TicksBelow no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3093 | grooveCenter.ry() -= tickSize; never executed: grooveCenter.ry() -= tickSize; | 0 |
3094 | } else { executed: } Execution Count:1 | 1 |
3095 | rect.setWidth(7); | - |
3096 | if (slider->tickPosition & QSlider::TicksAbove) never evaluated: slider->tickPosition & QSlider::TicksAbove | 0 |
3097 | grooveCenter.rx() += tickSize; never executed: grooveCenter.rx() += tickSize; | 0 |
3098 | if (slider->tickPosition & QSlider::TicksBelow) never evaluated: slider->tickPosition & QSlider::TicksBelow | 0 |
3099 | grooveCenter.rx() -= tickSize; never executed: grooveCenter.rx() -= tickSize; | 0 |
3100 | } | 0 |
3101 | rect.moveCenter(grooveCenter); | - |
3102 | break; executed: break; Execution Count:1 | 1 |
3103 | } | - |
3104 | default: | - |
3105 | break; | 0 |
3106 | } | - |
3107 | } executed: } Execution Count:2 | 2 |
3108 | break; executed: break; Execution Count:2 | 2 |
3109 | case CC_SpinBox: | - |
3110 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { partially evaluated: const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option) yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
3111 | QSize bs; | - |
3112 | int center = spinbox->rect.height() / 2; | - |
3113 | int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; evaluated: spinbox->frame yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-8 |
3114 | int y = fw; | - |
3115 | bs.setHeight(qMax(8, spinbox->rect.height()/2 - y)); | - |
3116 | bs.setWidth(14); | - |
3117 | int x, lx, rx; | - |
3118 | x = spinbox->rect.width() - y - bs.width() + 2; | - |
3119 | lx = fw; | - |
3120 | rx = x - fw; | - |
3121 | switch (subControl) { | - |
3122 | case SC_SpinBoxUp: | - |
3123 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) partially evaluated: spinbox->buttonSymbols == QAbstractSpinBox::NoButtons no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
3124 | return QRect(); never executed: return QRect(); | 0 |
3125 | rect = QRect(x, fw, bs.width(), center - fw); | - |
3126 | break; executed: break; Execution Count:3 | 3 |
3127 | case SC_SpinBoxDown: | - |
3128 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) partially evaluated: spinbox->buttonSymbols == QAbstractSpinBox::NoButtons no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
3129 | return QRect(); never executed: return QRect(); | 0 |
3130 | | - |
3131 | rect = QRect(x, center, bs.width(), spinbox->rect.bottom() - center - fw + 1); | - |
3132 | break; executed: break; Execution Count:3 | 3 |
3133 | case SC_SpinBoxEditField: | - |
3134 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) { partially evaluated: spinbox->buttonSymbols == QAbstractSpinBox::NoButtons no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
3135 | rect = QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw); | - |
3136 | } else { | 0 |
3137 | rect = QRect(lx, fw, rx - qMax(fw - 1, 0), spinbox->rect.height() - 2*fw); | - |
3138 | } executed: } Execution Count:4 | 4 |
3139 | break; executed: break; Execution Count:4 | 4 |
3140 | case SC_SpinBoxFrame: | - |
3141 | rect = spinbox->rect; | - |
3142 | default: | - |
3143 | break; | 0 |
3144 | } | - |
3145 | rect = visualRect(spinbox->direction, spinbox->rect, rect); | - |
3146 | } executed: } Execution Count:10 | 10 |
3147 | break; executed: break; Execution Count:10 | 10 |
3148 | | - |
3149 | case CC_GroupBox: | - |
3150 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { partially evaluated: const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3151 | rect = option->rect; | - |
3152 | if (subControl == SC_GroupBoxFrame) evaluated: subControl == SC_GroupBoxFrame yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
3153 | return rect.adjusted(0, 0, 0, 0); executed: return rect.adjusted(0, 0, 0, 0); Execution Count:1 | 1 |
3154 | else if (subControl == SC_GroupBoxContents) { partially evaluated: subControl == SC_GroupBoxContents no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
3155 | QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin); | - |
3156 | int margin = 3; | - |
3157 | int leftMarginExtension = 0; | - |
3158 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - |
3159 | return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); never executed: return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); | 0 |
3160 | } | - |
3161 | | - |
3162 | QSize textSize = option->fontMetrics.boundingRect(groupBox->text).size() + QSize(2, 2); | - |
3163 | int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); | - |
3164 | int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); | - |
3165 | rect = QRect(); | - |
3166 | if (subControl == SC_GroupBoxCheckBox) { evaluated: subControl == SC_GroupBoxCheckBox yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
3167 | rect.setWidth(indicatorWidth); | - |
3168 | rect.setHeight(indicatorHeight); | - |
3169 | rect.moveTop(textSize.height() > indicatorHeight ? (textSize.height() - indicatorHeight) / 2 : 0); | - |
3170 | rect.moveLeft(1); | - |
3171 | } else if (subControl == SC_GroupBoxLabel) { executed: } Execution Count:1 partially evaluated: subControl == SC_GroupBoxLabel yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3172 | rect.setSize(textSize); | - |
3173 | rect.moveTop(1); | - |
3174 | if (option->subControls & QStyle::SC_GroupBoxCheckBox) partially evaluated: option->subControls & QStyle::SC_GroupBoxCheckBox yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3175 | rect.translate(indicatorWidth + 5, 0); executed: rect.translate(indicatorWidth + 5, 0); Execution Count:1 | 1 |
3176 | } executed: } Execution Count:1 | 1 |
3177 | return visualRect(option->direction, option->rect, rect); executed: return visualRect(option->direction, option->rect, rect); Execution Count:2 | 2 |
3178 | } | - |
3179 | | - |
3180 | return rect; never executed: return rect; | 0 |
3181 | | - |
3182 | case CC_ComboBox: | - |
3183 | switch (subControl) { | - |
3184 | case SC_ComboBoxArrow: | - |
3185 | rect = visualRect(option->direction, option->rect, rect); | - |
3186 | rect.setRect(rect.right() - 18, rect.top() - 2, | - |
3187 | 19, rect.height() + 4); | - |
3188 | rect = visualRect(option->direction, option->rect, rect); | - |
3189 | break; executed: break; Execution Count:2 | 2 |
3190 | case SC_ComboBoxEditField: { | - |
3191 | int frameWidth = 2; | - |
3192 | rect = visualRect(option->direction, option->rect, rect); | - |
3193 | rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth, | - |
3194 | option->rect.width() - 19 - 2 * frameWidth, | - |
3195 | option->rect.height() - 2 * frameWidth); | - |
3196 | if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { partially evaluated: const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3197 | if (!box->editable) { partially evaluated: !box->editable no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
3198 | rect.adjust(2, 0, 0, 0); | - |
3199 | if (box->state & (State_Sunken | State_On)) never evaluated: box->state & (State_Sunken | State_On) | 0 |
3200 | rect.translate(1, 1); never executed: rect.translate(1, 1); | 0 |
3201 | } | 0 |
3202 | } executed: } Execution Count:3 | 3 |
3203 | rect = visualRect(option->direction, option->rect, rect); | - |
3204 | break; executed: break; Execution Count:3 | 3 |
3205 | } | - |
3206 | default: | - |
3207 | break; | 0 |
3208 | } | - |
3209 | break; executed: break; Execution Count:5 | 5 |
3210 | case CC_TitleBar: | - |
3211 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) { partially evaluated: const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3212 | SubControl sc = subControl; | - |
3213 | QRect &ret = rect; | - |
3214 | const int indent = 3; | - |
3215 | const int controlTopMargin = 3; | - |
3216 | const int controlBottomMargin = 3; | - |
3217 | const int controlWidthMargin = 2; | - |
3218 | const int controlHeight = tb->rect.height() - controlTopMargin - controlBottomMargin ; | - |
3219 | const int delta = controlHeight + controlWidthMargin; | - |
3220 | int offset = 0; | - |
3221 | | - |
3222 | bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - |
3223 | bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - |
3224 | | - |
3225 | switch (sc) { | - |
3226 | case SC_TitleBarLabel: | - |
3227 | if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) { partially evaluated: tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3228 | ret = tb->rect; | - |
3229 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) never evaluated: tb->titleBarFlags & Qt::WindowSystemMenuHint | 0 |
3230 | ret.adjust(delta, 0, -delta, 0); never executed: ret.adjust(delta, 0, -delta, 0); | 0 |
3231 | if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) never evaluated: tb->titleBarFlags & Qt::WindowMinimizeButtonHint | 0 |
3232 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 |
3233 | if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) never evaluated: tb->titleBarFlags & Qt::WindowMaximizeButtonHint | 0 |
3234 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 |
3235 | if (tb->titleBarFlags & Qt::WindowShadeButtonHint) never evaluated: tb->titleBarFlags & Qt::WindowShadeButtonHint | 0 |
3236 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 |
3237 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint) never evaluated: tb->titleBarFlags & Qt::WindowContextHelpButtonHint | 0 |
3238 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 |
3239 | } | 0 |
3240 | break; executed: break; Execution Count:1 | 1 |
3241 | case SC_TitleBarContextHelpButton: | - |
3242 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint) never evaluated: tb->titleBarFlags & Qt::WindowContextHelpButtonHint | 0 |
3243 | offset += delta; never executed: offset += delta; | 0 |
3244 | case SC_TitleBarMinButton: code before this statement never executed: case SC_TitleBarMinButton: | 0 |
3245 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)) never evaluated: !isMinimized never evaluated: (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) | 0 |
3246 | offset += delta; never executed: offset += delta; | 0 |
3247 | else if (sc == SC_TitleBarMinButton) never evaluated: sc == SC_TitleBarMinButton | 0 |
3248 | break; | 0 |
3249 | case SC_TitleBarNormalButton: code before this statement never executed: case SC_TitleBarNormalButton: | 0 |
3250 | if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)) never evaluated: isMinimized never evaluated: (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) | 0 |
3251 | offset += delta; never executed: offset += delta; | 0 |
3252 | else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)) never evaluated: isMaximized never evaluated: (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) | 0 |
3253 | offset += delta; never executed: offset += delta; | 0 |
3254 | else if (sc == SC_TitleBarNormalButton) never evaluated: sc == SC_TitleBarNormalButton | 0 |
3255 | break; | 0 |
3256 | case SC_TitleBarMaxButton: code before this statement never executed: case SC_TitleBarMaxButton: | 0 |
3257 | if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)) never evaluated: !isMaximized never evaluated: (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) | 0 |
3258 | offset += delta; never executed: offset += delta; | 0 |
3259 | else if (sc == SC_TitleBarMaxButton) never evaluated: sc == SC_TitleBarMaxButton | 0 |
3260 | break; | 0 |
3261 | case SC_TitleBarShadeButton: code before this statement never executed: case SC_TitleBarShadeButton: | 0 |
3262 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint)) never evaluated: !isMinimized never evaluated: (tb->titleBarFlags & Qt::WindowShadeButtonHint) | 0 |
3263 | offset += delta; never executed: offset += delta; | 0 |
3264 | else if (sc == SC_TitleBarShadeButton) never evaluated: sc == SC_TitleBarShadeButton | 0 |
3265 | break; | 0 |
3266 | case SC_TitleBarUnshadeButton: code before this statement never executed: case SC_TitleBarUnshadeButton: | 0 |
3267 | if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint)) never evaluated: isMinimized never evaluated: (tb->titleBarFlags & Qt::WindowShadeButtonHint) | 0 |
3268 | offset += delta; never executed: offset += delta; | 0 |
3269 | else if (sc == SC_TitleBarUnshadeButton) never evaluated: sc == SC_TitleBarUnshadeButton | 0 |
3270 | break; | 0 |
3271 | case SC_TitleBarCloseButton: code before this statement never executed: case SC_TitleBarCloseButton: | 0 |
3272 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) never evaluated: tb->titleBarFlags & Qt::WindowSystemMenuHint | 0 |
3273 | offset += delta; never executed: offset += delta; | 0 |
3274 | else if (sc == SC_TitleBarCloseButton) never evaluated: sc == SC_TitleBarCloseButton | 0 |
3275 | break; | 0 |
3276 | ret.setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin, | - |
3277 | controlHeight, controlHeight); | - |
3278 | break; | 0 |
3279 | case SC_TitleBarSysMenu: | - |
3280 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) { never evaluated: tb->titleBarFlags & Qt::WindowSystemMenuHint | 0 |
3281 | ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin, | - |
3282 | controlHeight, controlHeight); | - |
3283 | } | 0 |
3284 | break; | 0 |
3285 | default: | - |
3286 | break; | 0 |
3287 | } | - |
3288 | ret = visualRect(tb->direction, tb->rect, ret); | - |
3289 | } executed: } Execution Count:1 | 1 |
3290 | break; executed: break; Execution Count:1 | 1 |
3291 | default: | - |
3292 | break; executed: break; Execution Count:586 | 586 |
3293 | } | - |
3294 | | - |
3295 | return rect; executed: return rect; Execution Count:604 | 604 |
3296 | } | - |
3297 | | - |
3298 | | - |
3299 | | - |
3300 | | - |
3301 | | - |
3302 | QRect QFusionStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const | - |
3303 | { | - |
3304 | return QCommonStyle::itemPixmapRect(r, flags, pixmap); executed: return QCommonStyle::itemPixmapRect(r, flags, pixmap); Execution Count:1 | 1 |
3305 | } | - |
3306 | | - |
3307 | | - |
3308 | | - |
3309 | | - |
3310 | void QFusionStyle::drawItemPixmap(QPainter *painter, const QRect &rect, | - |
3311 | int alignment, const QPixmap &pixmap) const | - |
3312 | { | - |
3313 | QCommonStyle::drawItemPixmap(painter, rect, alignment, pixmap); | - |
3314 | } executed: } Execution Count:1 | 1 |
3315 | | - |
3316 | | - |
3317 | | - |
3318 | | - |
3319 | QStyle::SubControl QFusionStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - |
3320 | const QPoint &pt, const QWidget *w) const | - |
3321 | { | - |
3322 | return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); never executed: return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); | 0 |
3323 | } | - |
3324 | | - |
3325 | | - |
3326 | | - |
3327 | | - |
3328 | QPixmap QFusionStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, | - |
3329 | const QStyleOption *opt) const | - |
3330 | { | - |
3331 | return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); never executed: return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); | 0 |
3332 | } | - |
3333 | | - |
3334 | | - |
3335 | | - |
3336 | | - |
3337 | int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, | - |
3338 | QStyleHintReturn *returnData) const | - |
3339 | { | - |
3340 | switch (hint) { | - |
3341 | case SH_Slider_SnapToValue: | - |
3342 | case SH_PrintDialog_RightAlignButtons: | - |
3343 | case SH_FontDialog_SelectAssociatedText: | - |
3344 | case SH_MenuBar_AltKeyNavigation: | - |
3345 | case SH_ComboBox_ListMouseTracking: | - |
3346 | case SH_ScrollBar_StopMouseOverSlider: | - |
3347 | case SH_ScrollBar_MiddleClickAbsolutePosition: | - |
3348 | case SH_EtchDisabledText: | - |
3349 | case SH_TitleBar_AutoRaise: | - |
3350 | case SH_TitleBar_NoBorder: | - |
3351 | case SH_ItemView_ShowDecorationSelected: | - |
3352 | case SH_ItemView_ArrowKeysNavigateIntoChildren: | - |
3353 | case SH_ItemView_ChangeHighlightOnFocus: | - |
3354 | case SH_MenuBar_MouseTracking: | - |
3355 | case SH_Menu_MouseTracking: | - |
3356 | return 1; executed: return 1; Execution Count:31 | 31 |
3357 | | - |
3358 | case SH_ToolBox_SelectedPageTitleBold: | - |
3359 | case SH_ScrollView_FrameOnlyAroundContents: | - |
3360 | case SH_Menu_AllowActiveAndDisabled: | - |
3361 | case SH_MainWindow_SpaceBelowMenuBar: | - |
3362 | case SH_DialogButtonBox_ButtonsHaveIcons: | - |
3363 | case SH_MessageBox_CenterButtons: | - |
3364 | case SH_RubberBand_Mask: | - |
3365 | return 0; executed: return 0; Execution Count:1071 | 1071 |
3366 | | - |
3367 | case SH_ComboBox_Popup: | - |
3368 | if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) evaluated: const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option) yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
3369 | return !cmb->editable; executed: return !cmb->editable; Execution Count:1 | 1 |
3370 | return 0; executed: return 0; Execution Count:2 | 2 |
3371 | | - |
3372 | case SH_Table_GridLineColor: | - |
3373 | return option ? option->palette.background().color().darker(120).rgb() : 0; executed: return option ? option->palette.background().color().darker(120).rgb() : 0; Execution Count:2 | 2 |
3374 | | - |
3375 | case SH_MessageBox_TextInteractionFlags: | - |
3376 | return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; executed: return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; Execution Count:2 | 2 |
3377 | | - |
3378 | case SH_WizardStyle: | - |
3379 | return QWizard::ClassicStyle; executed: return QWizard::ClassicStyle; Execution Count:2 | 2 |
3380 | | - |
3381 | case SH_Menu_SubMenuPopupDelay: | - |
3382 | return 225; executed: return 225; Execution Count:2 | 2 |
3383 | | - |
3384 | case SH_WindowFrame_Mask: | - |
3385 | if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask *>(returnData)) { partially evaluated: QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask *>(returnData) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
3386 | | - |
3387 | mask->region = option->rect; | - |
3388 | mask->region -= QRect(option->rect.left(), option->rect.top(), 5, 1); | - |
3389 | mask->region -= QRect(option->rect.left(), option->rect.top() + 1, 3, 1); | - |
3390 | mask->region -= QRect(option->rect.left(), option->rect.top() + 2, 2, 1); | - |
3391 | mask->region -= QRect(option->rect.left(), option->rect.top() + 3, 1, 2); | - |
3392 | | - |
3393 | | - |
3394 | mask->region -= QRect(option->rect.right() - 4, option->rect.top(), 5, 1); | - |
3395 | mask->region -= QRect(option->rect.right() - 2, option->rect.top() + 1, 3, 1); | - |
3396 | mask->region -= QRect(option->rect.right() - 1, option->rect.top() + 2, 2, 1); | - |
3397 | mask->region -= QRect(option->rect.right() , option->rect.top() + 3, 1, 2); | - |
3398 | return 1; never executed: return 1; | 0 |
3399 | } | - |
3400 | default: | - |
3401 | break; executed: break; Execution Count:12137 | 12137 |
3402 | } | - |
3403 | return QCommonStyle::styleHint(hint, option, widget, returnData); executed: return QCommonStyle::styleHint(hint, option, widget, returnData); Execution Count:12137 | 12137 |
3404 | } | - |
3405 | | - |
3406 | | - |
3407 | QRect QFusionStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const | - |
3408 | { | - |
3409 | QRect r = QCommonStyle::subElementRect(sr, opt, w); | - |
3410 | switch (sr) { | - |
3411 | case SE_ProgressBarLabel: | - |
3412 | case SE_ProgressBarContents: | - |
3413 | case SE_ProgressBarGroove: | - |
3414 | return opt->rect; executed: return opt->rect; Execution Count:6 | 6 |
3415 | case SE_PushButtonFocusRect: | - |
3416 | r.adjust(0, 1, 0, -1); | - |
3417 | break; | 0 |
3418 | case SE_DockWidgetTitleBarText: { | - |
3419 | if (const QStyleOptionDockWidget *titlebar = qstyleoption_cast<const QStyleOptionDockWidget*>(opt)) { never evaluated: const QStyleOptionDockWidget *titlebar = qstyleoption_cast<const QStyleOptionDockWidget*>(opt) | 0 |
3420 | bool verticalTitleBar = titlebar->verticalTitleBar; | - |
3421 | if (verticalTitleBar) { never evaluated: verticalTitleBar | 0 |
3422 | r.adjust(0, 0, 0, -4); | - |
3423 | } else { | 0 |
3424 | if (opt->direction == Qt::LeftToRight) never evaluated: opt->direction == Qt::LeftToRight | 0 |
3425 | r.adjust(4, 0, 0, 0); never executed: r.adjust(4, 0, 0, 0); | 0 |
3426 | else | - |
3427 | r.adjust(0, 0, -4, 0); never executed: r.adjust(0, 0, -4, 0); | 0 |
3428 | } | - |
3429 | } | - |
3430 | | - |
3431 | break; | 0 |
3432 | } | - |
3433 | default: | - |
3434 | break; executed: break; Execution Count:1608 | 1608 |
3435 | } | - |
3436 | return r; executed: return r; Execution Count:1608 | 1608 |
3437 | } | - |
3438 | | - |
3439 | | - |
3440 | | - |
3441 | | - |
3442 | QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, | - |
3443 | const QWidget *widget) const | - |
3444 | { | - |
3445 | return QCommonStyle::standardIcon(standardIcon, option, widget); executed: return QCommonStyle::standardIcon(standardIcon, option, widget); Execution Count:28 | 28 |
3446 | } | - |
3447 | | - |
3448 | | - |
3449 | | - |
3450 | | - |
3451 | QPixmap QFusionStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, | - |
3452 | const QWidget *widget) const | - |
3453 | { | - |
3454 | | - |
3455 | switch (standardPixmap) { | - |
3456 | case SP_TitleBarNormalButton: | - |
3457 | return QPixmap((const char **)dock_widget_restore_xpm); executed: return QPixmap((const char **)dock_widget_restore_xpm); Execution Count:2 | 2 |
3458 | case SP_TitleBarMinButton: | - |
3459 | return QPixmap((const char **)workspace_minimize); executed: return QPixmap((const char **)workspace_minimize); Execution Count:2 | 2 |
3460 | case SP_TitleBarCloseButton: | - |
3461 | case SP_DockWidgetCloseButton: | - |
3462 | return QPixmap((const char **)dock_widget_close_xpm); executed: return QPixmap((const char **)dock_widget_close_xpm); Execution Count:4 | 4 |
3463 | | - |
3464 | default: | - |
3465 | break; executed: break; Execution Count:43 | 43 |
3466 | } | - |
3467 | | - |
3468 | | - |
3469 | return QCommonStyle::standardPixmap(standardPixmap, opt, widget); executed: return QCommonStyle::standardPixmap(standardPixmap, opt, widget); Execution Count:43 | 43 |
3470 | } | - |
3471 | | - |
3472 | | - |
3473 | | - |
| | |