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