qstylesheetstyle.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qstylesheetstyle.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8using namespace QCss;-
9-
10-
11class QStyleSheetStylePrivate : public QWindowsStylePrivate-
12{-
13 inline QStyleSheetStyle* q_func() { return static_cast<QStyleSheetStyle *>(q_ptr); } inline const QStyleSheetStyle* q_func() const { return static_cast<const QStyleSheetStyle *>(q_ptr); } friend class QStyleSheetStyle;-
14public:-
15 QStyleSheetStylePrivate() { }-
16};-
17-
18-
19static QStyleSheetStyleCaches *styleSheetCaches = 0;-
20static const QStyleSheetStyle *globalStyleSheetStyle = 0;-
21class QStyleSheetStyleRecursionGuard-
22{-
23 public:-
24 QStyleSheetStyleRecursionGuard(const QStyleSheetStyle *that)-
25 : guarded(globalStyleSheetStyle == 0)-
26 {-
27 if (guarded) globalStyleSheetStyle = that;-
28 }-
29 ~QStyleSheetStyleRecursionGuard() { if (guarded) globalStyleSheetStyle = 0; }-
30 bool guarded;-
31};-
32-
33-
34-
35-
36-
37-
38enum PseudoElement {-
39 PseudoElement_None,-
40 PseudoElement_DownArrow,-
41 PseudoElement_UpArrow,-
42 PseudoElement_LeftArrow,-
43 PseudoElement_RightArrow,-
44 PseudoElement_Indicator,-
45 PseudoElement_ExclusiveIndicator,-
46 PseudoElement_PushButtonMenuIndicator,-
47 PseudoElement_ComboBoxDropDown,-
48 PseudoElement_ComboBoxArrow,-
49 PseudoElement_Item,-
50 PseudoElement_SpinBoxUpButton,-
51 PseudoElement_SpinBoxUpArrow,-
52 PseudoElement_SpinBoxDownButton,-
53 PseudoElement_SpinBoxDownArrow,-
54 PseudoElement_GroupBoxTitle,-
55 PseudoElement_GroupBoxIndicator,-
56 PseudoElement_ToolButtonMenu,-
57 PseudoElement_ToolButtonMenuArrow,-
58 PseudoElement_ToolButtonDownArrow,-
59 PseudoElement_ToolBoxTab,-
60 PseudoElement_ScrollBarSlider,-
61 PseudoElement_ScrollBarAddPage,-
62 PseudoElement_ScrollBarSubPage,-
63 PseudoElement_ScrollBarAddLine,-
64 PseudoElement_ScrollBarSubLine,-
65 PseudoElement_ScrollBarFirst,-
66 PseudoElement_ScrollBarLast,-
67 PseudoElement_ScrollBarUpArrow,-
68 PseudoElement_ScrollBarDownArrow,-
69 PseudoElement_ScrollBarLeftArrow,-
70 PseudoElement_ScrollBarRightArrow,-
71 PseudoElement_SplitterHandle,-
72 PseudoElement_ToolBarHandle,-
73 PseudoElement_ToolBarSeparator,-
74 PseudoElement_MenuScroller,-
75 PseudoElement_MenuTearoff,-
76 PseudoElement_MenuCheckMark,-
77 PseudoElement_MenuSeparator,-
78 PseudoElement_MenuIcon,-
79 PseudoElement_MenuRightArrow,-
80 PseudoElement_TreeViewBranch,-
81 PseudoElement_HeaderViewSection,-
82 PseudoElement_HeaderViewUpArrow,-
83 PseudoElement_HeaderViewDownArrow,-
84 PseudoElement_ProgressBarChunk,-
85 PseudoElement_TabBarTab,-
86 PseudoElement_TabBarScroller,-
87 PseudoElement_TabBarTear,-
88 PseudoElement_SliderGroove,-
89 PseudoElement_SliderHandle,-
90 PseudoElement_SliderAddPage,-
91 PseudoElement_SliderSubPage,-
92 PseudoElement_SliderTickmark,-
93 PseudoElement_TabWidgetPane,-
94 PseudoElement_TabWidgetTabBar,-
95 PseudoElement_TabWidgetLeftCorner,-
96 PseudoElement_TabWidgetRightCorner,-
97 PseudoElement_DockWidgetTitle,-
98 PseudoElement_DockWidgetCloseButton,-
99 PseudoElement_DockWidgetFloatButton,-
100 PseudoElement_DockWidgetSeparator,-
101 PseudoElement_MdiCloseButton,-
102 PseudoElement_MdiMinButton,-
103 PseudoElement_MdiNormalButton,-
104 PseudoElement_TitleBar,-
105 PseudoElement_TitleBarCloseButton,-
106 PseudoElement_TitleBarMinButton,-
107 PseudoElement_TitleBarMaxButton,-
108 PseudoElement_TitleBarShadeButton,-
109 PseudoElement_TitleBarUnshadeButton,-
110 PseudoElement_TitleBarNormalButton,-
111 PseudoElement_TitleBarContextHelpButton,-
112 PseudoElement_TitleBarSysMenu,-
113 PseudoElement_ViewItem,-
114 PseudoElement_ViewItemIcon,-
115 PseudoElement_ViewItemText,-
116 PseudoElement_ViewItemIndicator,-
117 PseudoElement_ScrollAreaCorner,-
118 PseudoElement_TabBarTabCloseButton,-
119 NumPseudoElements-
120};-
121-
122struct PseudoElementInfo {-
123 QStyle::SubControl subControl;-
124 const char name[19];-
125};-
126-
127static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {-
128 { QStyle::SC_None, "" },-
129 { QStyle::SC_None, "down-arrow" },-
130 { QStyle::SC_None, "up-arrow" },-
131 { QStyle::SC_None, "left-arrow" },-
132 { QStyle::SC_None, "right-arrow" },-
133 { QStyle::SC_None, "indicator" },-
134 { QStyle::SC_None, "indicator" },-
135 { QStyle::SC_None, "menu-indicator" },-
136 { QStyle::SC_ComboBoxArrow, "drop-down" },-
137 { QStyle::SC_ComboBoxArrow, "down-arrow" },-
138 { QStyle::SC_None, "item" },-
139 { QStyle::SC_SpinBoxUp, "up-button" },-
140 { QStyle::SC_SpinBoxUp, "up-arrow" },-
141 { QStyle::SC_SpinBoxDown, "down-button" },-
142 { QStyle::SC_SpinBoxDown, "down-arrow" },-
143 { QStyle::SC_GroupBoxLabel, "title" },-
144 { QStyle::SC_GroupBoxCheckBox, "indicator" },-
145 { QStyle::SC_ToolButtonMenu, "menu-button" },-
146 { QStyle::SC_ToolButtonMenu, "menu-arrow" },-
147 { QStyle::SC_None, "menu-indicator" },-
148 { QStyle::SC_None, "tab" },-
149 { QStyle::SC_ScrollBarSlider, "handle" },-
150 { QStyle::SC_ScrollBarAddPage, "add-page" },-
151 { QStyle::SC_ScrollBarSubPage, "sub-page" },-
152 { QStyle::SC_ScrollBarAddLine, "add-line" },-
153 { QStyle::SC_ScrollBarSubLine, "sub-line" },-
154 { QStyle::SC_ScrollBarFirst, "first" },-
155 { QStyle::SC_ScrollBarLast, "last" },-
156 { QStyle::SC_ScrollBarSubLine, "up-arrow" },-
157 { QStyle::SC_ScrollBarAddLine, "down-arrow" },-
158 { QStyle::SC_ScrollBarSubLine, "left-arrow" },-
159 { QStyle::SC_ScrollBarAddLine, "right-arrow" },-
160 { QStyle::SC_None, "handle" },-
161 { QStyle::SC_None, "handle" },-
162 { QStyle::SC_None, "separator" },-
163 { QStyle::SC_None, "scroller" },-
164 { QStyle::SC_None, "tearoff" },-
165 { QStyle::SC_None, "indicator" },-
166 { QStyle::SC_None, "separator" },-
167 { QStyle::SC_None, "icon" },-
168 { QStyle::SC_None, "right-arrow" },-
169 { QStyle::SC_None, "branch" },-
170 { QStyle::SC_None, "section" },-
171 { QStyle::SC_None, "down-arrow" },-
172 { QStyle::SC_None, "up-arrow" },-
173 { QStyle::SC_None, "chunk" },-
174 { QStyle::SC_None, "tab" },-
175 { QStyle::SC_None, "scroller" },-
176 { QStyle::SC_None, "tear" },-
177 { QStyle::SC_SliderGroove, "groove" },-
178 { QStyle::SC_SliderHandle, "handle" },-
179 { QStyle::SC_None, "add-page" },-
180 { QStyle::SC_None, "sub-page"},-
181 { QStyle::SC_SliderTickmarks, "tick-mark" },-
182 { QStyle::SC_None, "pane" },-
183 { QStyle::SC_None, "tab-bar" },-
184 { QStyle::SC_None, "left-corner" },-
185 { QStyle::SC_None, "right-corner" },-
186 { QStyle::SC_None, "title" },-
187 { QStyle::SC_None, "close-button" },-
188 { QStyle::SC_None, "float-button" },-
189 { QStyle::SC_None, "separator" },-
190 { QStyle::SC_MdiCloseButton, "close-button" },-
191 { QStyle::SC_MdiMinButton, "minimize-button" },-
192 { QStyle::SC_MdiNormalButton, "normal-button" },-
193 { QStyle::SC_TitleBarLabel, "title" },-
194 { QStyle::SC_TitleBarCloseButton, "close-button" },-
195 { QStyle::SC_TitleBarMinButton, "minimize-button" },-
196 { QStyle::SC_TitleBarMaxButton, "maximize-button" },-
197 { QStyle::SC_TitleBarShadeButton, "shade-button" },-
198 { QStyle::SC_TitleBarUnshadeButton, "unshade-button" },-
199 { QStyle::SC_TitleBarNormalButton, "normal-button" },-
200 { QStyle::SC_TitleBarContextHelpButton, "contexthelp-button" },-
201 { QStyle::SC_TitleBarSysMenu, "sys-menu" },-
202 { QStyle::SC_None, "item" },-
203 { QStyle::SC_None, "icon" },-
204 { QStyle::SC_None, "text" },-
205 { QStyle::SC_None, "indicator" },-
206 { QStyle::SC_None, "corner" },-
207 { QStyle::SC_None, "close-button" },-
208};-
209-
210-
211struct QStyleSheetBorderImageData : public QSharedData-
212{-
213 QStyleSheetBorderImageData()-
214 : horizStretch(QCss::TileMode_Unknown), vertStretch(QCss::TileMode_Unknown)-
215 {-
216 for (int i = 0; i < 4; i++)-
217 cuts[i] = -1;-
218 }-
219 int cuts[4];-
220 QPixmap pixmap;-
221 QImage image;-
222 QCss::TileMode horizStretch, vertStretch;-
223};-
224-
225struct QStyleSheetBackgroundData : public QSharedData-
226{-
227 QStyleSheetBackgroundData(const QBrush& b, const QPixmap& p, QCss::Repeat r,-
228 Qt::Alignment a, QCss::Origin o, Attachment t, QCss::Origin c)-
229 : brush(b), pixmap(p), repeat(r), position(a), origin(o), attachment(t), clip(c) { }-
230-
231 bool isTransparent() const {-
232 if (brush.style() != Qt::NoBrush)-
233 return !brush.isOpaque();-
234 return pixmap.isNull() ? false : pixmap.hasAlpha();-
235 }-
236 QBrush brush;-
237 QPixmap pixmap;-
238 QCss::Repeat repeat;-
239 Qt::Alignment position;-
240 QCss::Origin origin;-
241 QCss::Attachment attachment;-
242 QCss::Origin clip;-
243};-
244-
245struct QStyleSheetBorderData : public QSharedData-
246{-
247 QStyleSheetBorderData() : bi(0)-
248 {-
249 for (int i = 0; i < 4; i++) {-
250 borders[i] = 0;-
251 styles[i] = QCss::BorderStyle_None;-
252 }-
253 }-
254-
255 QStyleSheetBorderData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r) : bi(0)-
256 {-
257 for (int i = 0; i < 4; i++) {-
258 borders[i] = b[i];-
259 styles[i] = s[i];-
260 colors[i] = c[i];-
261 radii[i] = r[i];-
262 }-
263 }-
264-
265 int borders[4];-
266 QBrush colors[4];-
267 QCss::BorderStyle styles[4];-
268 QSize radii[4];-
269-
270 const QStyleSheetBorderImageData *borderImage() const-
271 { return bi; }-
272 bool hasBorderImage() const { return bi!=0; }-
273-
274 QSharedDataPointer<QStyleSheetBorderImageData> bi;-
275-
276 bool isOpaque() const-
277 {-
278 for (int i = 0; i < 4; i++) {-
279 if (styles[i] == QCss::BorderStyle_Native || styles[i] == QCss::BorderStyle_None)-
280 continue;-
281 if (styles[i] >= QCss::BorderStyle_Dotted && styles[i] <= QCss::BorderStyle_DotDotDash-
282 && styles[i] != BorderStyle_Solid)-
283 return false;-
284 if (!colors[i].isOpaque())-
285 return false;-
286 if (!radii[i].isEmpty())-
287 return false;-
288 }-
289 if (bi != 0 && bi->pixmap.hasAlpha())-
290 return false;-
291 return true;-
292 }-
293};-
294-
295-
296struct QStyleSheetOutlineData : public QStyleSheetBorderData-
297{-
298 QStyleSheetOutlineData()-
299 {-
300 for (int i = 0; i < 4; i++) {-
301 offsets[i] = 0;-
302 }-
303 }-
304-
305 QStyleSheetOutlineData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r, int *o)-
306 : QStyleSheetBorderData(b, c, s, r)-
307 {-
308 for (int i = 0; i < 4; i++) {-
309 offsets[i] = o[i];-
310 }-
311 }-
312-
313 int offsets[4];-
314};-
315-
316struct QStyleSheetBoxData : public QSharedData-
317{-
318 QStyleSheetBoxData(int *m, int *p, int s) : spacing(s)-
319 {-
320 for (int i = 0; i < 4; i++) {-
321 margins[i] = m[i];-
322 paddings[i] = p[i];-
323 }-
324 }-
325-
326 int margins[4];-
327 int paddings[4];-
328-
329 int spacing;-
330};-
331-
332struct QStyleSheetPaletteData : public QSharedData-
333{-
334 QStyleSheetPaletteData(const QBrush &fg, const QBrush &sfg, const QBrush &sbg,-
335 const QBrush &abg)-
336 : foreground(fg), selectionForeground(sfg), selectionBackground(sbg),-
337 alternateBackground(abg) { }-
338-
339 QBrush foreground;-
340 QBrush selectionForeground;-
341 QBrush selectionBackground;-
342 QBrush alternateBackground;-
343};-
344-
345struct QStyleSheetGeometryData : public QSharedData-
346{-
347 QStyleSheetGeometryData(int w, int h, int minw, int minh, int maxw, int maxh)-
348 : minWidth(minw), minHeight(minh), width(w), height(h), maxWidth(maxw), maxHeight(maxh) { }-
349-
350 int minWidth, minHeight, width, height, maxWidth, maxHeight;-
351};-
352-
353struct QStyleSheetPositionData : public QSharedData-
354{-
355 QStyleSheetPositionData(int l, int t, int r, int b, Origin o, Qt::Alignment p, QCss::PositionMode m, Qt::Alignment a = 0)-
356 : left(l), top(t), bottom(b), right(r), origin(o), position(p), mode(m), textAlignment(a) { }-
357-
358 int left, top, bottom, right;-
359 Origin origin;-
360 Qt::Alignment position;-
361 QCss::PositionMode mode;-
362 Qt::Alignment textAlignment;-
363};-
364-
365struct QStyleSheetImageData : public QSharedData-
366{-
367 QStyleSheetImageData(const QIcon &i, Qt::Alignment a, const QSize &sz)-
368 : icon(i), alignment(a), size(sz) { }-
369-
370 QIcon icon;-
371 Qt::Alignment alignment;-
372 QSize size;-
373};-
374-
375class QRenderRule-
376{-
377public:-
378 QRenderRule() : features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0) { }-
379 QRenderRule(const QVector<QCss::Declaration> &, const QObject *);-
380-
381 QRect borderRect(const QRect &r) const;-
382 QRect outlineRect(const QRect &r) const;-
383 QRect paddingRect(const QRect &r) const;-
384 QRect contentsRect(const QRect &r) const;-
385-
386 enum { Margin = 1, Border = 2, Padding = 4, All=Margin|Border|Padding };-
387 QRect boxRect(const QRect &r, int flags = All) const;-
388 QSize boxSize(const QSize &s, int flags = All) const;-
389 QRect originRect(const QRect &rect, Origin origin) const;-
390-
391 QPainterPath borderClip(QRect rect);-
392 void drawBorder(QPainter *, const QRect&);-
393 void drawOutline(QPainter *, const QRect&);-
394 void drawBorderImage(QPainter *, const QRect&);-
395 void drawBackground(QPainter *, const QRect&, const QPoint& = QPoint(0, 0));-
396 void drawBackgroundImage(QPainter *, const QRect&, QPoint = QPoint(0, 0));-
397 void drawFrame(QPainter *, const QRect&);-
398 void drawImage(QPainter *p, const QRect &rect);-
399 void drawRule(QPainter *, const QRect&);-
400 void configurePalette(QPalette *, QPalette::ColorGroup, const QWidget *, bool);-
401 void configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette::ColorRole br);-
402-
403 const QStyleSheetPaletteData *palette() const { return pal; }-
404 const QStyleSheetBoxData *box() const { return b; }-
405 const QStyleSheetBackgroundData *background() const { return bg; }-
406 const QStyleSheetBorderData *border() const { return bd; }-
407 const QStyleSheetOutlineData *outline() const { return ou; }-
408 const QStyleSheetGeometryData *geometry() const { return geo; }-
409 const QStyleSheetPositionData *position() const { return p; }-
410-
411 bool hasPalette() const { return pal != 0; }-
412 bool hasBackground() const { return bg != 0 && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush); }-
413 bool hasGradientBackground() const { return bg && bg->brush.style() >= Qt::LinearGradientPattern-
414 && bg->brush.style() <= Qt::ConicalGradientPattern; }-
415-
416 bool hasNativeBorder() const {-
417 return bd == 0-
418 || (!bd->hasBorderImage() && bd->styles[0] == BorderStyle_Native);-
419 }-
420-
421 bool hasNativeOutline() const {-
422 return (ou == 0-
423 || (!ou->hasBorderImage() && ou->styles[0] == BorderStyle_Native));-
424 }-
425-
426 bool baseStyleCanDraw() const {-
427 if (!hasBackground() || (background()->brush.style() == Qt::NoBrush && bg->pixmap.isNull()))-
428 return true;-
429 if (bg && !bg->pixmap.isNull())-
430 return false;-
431 if (hasGradientBackground())-
432 return features & StyleFeature_BackgroundGradient;-
433 return features & StyleFeature_BackgroundColor;-
434 }-
435-
436 bool hasBox() const { return b != 0; }-
437 bool hasBorder() const { return bd != 0; }-
438 bool hasOutline() const { return ou != 0; }-
439 bool hasPosition() const { return p != 0; }-
440 bool hasGeometry() const { return geo != 0; }-
441 bool hasDrawable() const { return !hasNativeBorder() || hasBackground() || hasImage(); }-
442 bool hasImage() const { return img != 0; }-
443-
444 QSize minimumContentsSize() const-
445 { return geo ? QSize(geo->minWidth, geo->minHeight) : QSize(0, 0); }-
446 QSize minimumSize() const-
447 { return boxSize(minimumContentsSize()); }-
448-
449 QSize contentsSize() const-
450 { return geo ? QSize(geo->width, geo->height)-
451 : ((img && img->size.isValid()) ? img->size : QSize()); }-
452 QSize contentsSize(const QSize &sz) const-
453 {-
454 QSize csz = contentsSize();-
455 if (csz.width() == -1) csz.setWidth(sz.width());-
456 if (csz.height() == -1) csz.setHeight(sz.height());-
457 return csz;-
458 }-
459 bool hasContentsSize() const-
460 { return (geo && (geo->width != -1 || geo->height != -1)) || (img && img->size.isValid()); }-
461-
462 QSize size() const { return boxSize(contentsSize()); }-
463 QSize size(const QSize &sz) const { return boxSize(contentsSize(sz)); }-
464 QSize adjustSize(const QSize &sz)-
465 {-
466 if (!geo)-
467 return sz;-
468 QSize csz = contentsSize();-
469 if (csz.width() == -1) csz.setWidth(sz.width());-
470 if (csz.height() == -1) csz.setHeight(sz.height());-
471 if (geo->maxWidth != -1 && csz.width() > geo->maxWidth) csz.setWidth(geo->maxWidth);-
472 if (geo->maxHeight != -1 && csz.height() > geo->maxHeight) csz.setHeight(geo->maxHeight);-
473 csz=csz.expandedTo(QSize(geo->minWidth, geo->minHeight));-
474 return csz;-
475 }-
476-
477 bool hasStyleHint(const QString &sh) const { return styleHints.contains(sh); }-
478 QVariant styleHint(const QString &sh) const { return styleHints.value(sh); }-
479-
480 void fixupBorder(int);-
481-
482-
483 void setClip(QPainter *p, const QRect &rect);-
484 void unsetClip(QPainter *);-
485-
486public:-
487 int features;-
488 QBrush defaultBackground;-
489 QFont font;-
490 bool hasFont;-
491-
492 QHash<QString, QVariant> styleHints;-
493-
494 QSharedDataPointer<QStyleSheetPaletteData> pal;-
495 QSharedDataPointer<QStyleSheetBoxData> b;-
496 QSharedDataPointer<QStyleSheetBackgroundData> bg;-
497 QSharedDataPointer<QStyleSheetBorderData> bd;-
498 QSharedDataPointer<QStyleSheetOutlineData> ou;-
499 QSharedDataPointer<QStyleSheetGeometryData> geo;-
500 QSharedDataPointer<QStyleSheetPositionData> p;-
501 QSharedDataPointer<QStyleSheetImageData> img;-
502-
503 int clipset;-
504 QPainterPath clipPath;-
505};-
506template<> class QTypeInfo<QRenderRule > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QRenderRule)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QRenderRule >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QRenderRule) }; static inline const char *name() { return "QRenderRule"; } };-
507-
508-
509static const char knownStyleHints[][45] = {-
510 "activate-on-singleclick",-
511 "alignment",-
512 "arrow-keys-navigate-into-children",-
513 "backward-icon",-
514 "button-layout",-
515 "cd-icon",-
516 "combobox-list-mousetracking",-
517 "combobox-popup",-
518 "computer-icon",-
519 "desktop-icon",-
520 "dialog-apply-icon",-
521 "dialog-cancel-icon",-
522 "dialog-close-icon",-
523 "dialog-discard-icon",-
524 "dialog-help-icon",-
525 "dialog-no-icon",-
526 "dialog-ok-icon",-
527 "dialog-open-icon",-
528 "dialog-reset-icon",-
529 "dialog-save-icon",-
530 "dialog-yes-icon",-
531 "dialogbuttonbox-buttons-have-icons",-
532 "directory-closed-icon",-
533 "directory-icon",-
534 "directory-link-icon",-
535 "directory-open-icon",-
536 "dither-disable-text",-
537 "dockwidget-close-icon",-
538 "downarrow-icon",-
539 "dvd-icon",-
540 "etch-disabled-text",-
541 "file-icon",-
542 "file-link-icon",-
543 "filedialog-backward-icon",-
544 "filedialog-contentsview-icon",-
545 "filedialog-detailedview-icon",-
546 "filedialog-end-icon",-
547 "filedialog-infoview-icon",-
548 "filedialog-listview-icon",-
549 "filedialog-new-directory-icon",-
550 "filedialog-parent-directory-icon",-
551 "filedialog-start-icon",-
552 "floppy-icon",-
553 "forward-icon",-
554 "gridline-color",-
555 "harddisk-icon",-
556 "home-icon",-
557 "icon-size",-
558 "leftarrow-icon",-
559 "lineedit-password-character",-
560 "lineedit-password-mask-delay",-
561 "mdi-fill-space-on-maximize",-
562 "menu-scrollable",-
563 "menubar-altkey-navigation",-
564 "menubar-separator",-
565 "messagebox-critical-icon",-
566 "messagebox-information-icon",-
567 "messagebox-question-icon",-
568 "messagebox-text-interaction-flags",-
569 "messagebox-warning-icon",-
570 "mouse-tracking",-
571 "network-icon",-
572 "opacity",-
573 "paint-alternating-row-colors-for-empty-area",-
574 "rightarrow-icon",-
575 "scrollbar-contextmenu",-
576 "scrollbar-leftclick-absolute-position",-
577 "scrollbar-middleclick-absolute-position",-
578 "scrollbar-roll-between-buttons",-
579 "scrollbar-scroll-when-pointer-leaves-control",-
580 "scrollview-frame-around-contents",-
581 "show-decoration-selected",-
582 "spinbox-click-autorepeat-rate",-
583 "spincontrol-disable-on-bounds",-
584 "tabbar-elide-mode",-
585 "tabbar-prefer-no-arrows",-
586 "titlebar-close-icon",-
587 "titlebar-contexthelp-icon",-
588 "titlebar-maximize-icon",-
589 "titlebar-menu-icon",-
590 "titlebar-minimize-icon",-
591 "titlebar-normal-icon",-
592 "titlebar-shade-icon",-
593 "titlebar-unshade-icon",-
594 "toolbutton-popup-delay",-
595 "trash-icon",-
596 "uparrow-icon"-
597};-
598-
599static const int numKnownStyleHints = sizeof(knownStyleHints)/sizeof(knownStyleHints[0]);-
600-
601static QList<QVariant> subControlLayout(const QString& layout)-
602{-
603 QList<QVariant> buttons;-
604 for (int i = 0; i < layout.count(); i++) {-
605 int button = layout[i].toLatin1();-
606 switch (button) {-
607 case 'm':-
608 buttons.append(PseudoElement_MdiMinButton);-
609 buttons.append(PseudoElement_TitleBarMinButton);-
610 break;-
611 case 'M':-
612 buttons.append(PseudoElement_TitleBarMaxButton);-
613 break;-
614 case 'X':-
615 buttons.append(PseudoElement_MdiCloseButton);-
616 buttons.append(PseudoElement_TitleBarCloseButton);-
617 break;-
618 case 'N':-
619 buttons.append(PseudoElement_MdiNormalButton);-
620 buttons.append(PseudoElement_TitleBarNormalButton);-
621 break;-
622 case 'I':-
623 buttons.append(PseudoElement_TitleBarSysMenu);-
624 break;-
625 case 'T':-
626 buttons.append(PseudoElement_TitleBar);-
627 break;-
628 case 'H':-
629 buttons.append(PseudoElement_TitleBarContextHelpButton);-
630 break;-
631 case 'S':-
632 buttons.append(PseudoElement_TitleBarShadeButton);-
633 break;-
634 default:-
635 buttons.append(button);-
636 break;-
637 }-
638 }-
639 return buttons;-
640}-
641-
642namespace {-
643 struct ButtonInfo {-
644 QRenderRule rule;-
645 int element;-
646 int offset;-
647 int where;-
648 int width;-
649 };-
650}-
651template <> class QTypeInfo<ButtonInfo> : public QTypeInfoMerger<ButtonInfo, QRenderRule, int> {};-
652-
653QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget *w, const QStyleOptionTitleBar *tb) const-
654{-
655 QHash<QStyle::SubControl, QRect> layoutRects;-
656 const bool isMinimized = tb->titleBarState & Qt::WindowMinimized;-
657 const bool isMaximized = tb->titleBarState & Qt::WindowMaximized;-
658 QRenderRule subRule = renderRule(w, tb);-
659 QRect cr = subRule.contentsRect(tb->rect);-
660 QList<QVariant> layout = subRule.styleHint(QLatin1String("button-layout")).toList();-
661 if (layout.isEmpty())-
662 layout = subControlLayout(QLatin1String("I(T)HSmMX"));-
663-
664 int offsets[3] = { 0, 0, 0 };-
665 enum Where { Left, Right, Center, NoWhere } where = Left;-
666 QVector<ButtonInfo> infos;-
667 const int numLayouts = layout.size();-
668 infos.reserve(numLayouts);-
669 for (int i = 0; i < numLayouts; i++) {-
670 const int element = layout[i].toInt();-
671 if (element == '(') {-
672 where = Center;-
673 } else if (element == ')') {-
674 where = Right;-
675 } else {-
676 ButtonInfo info;-
677 info.element = element;-
678 switch (element) {-
679 case PseudoElement_TitleBar:-
680 if (!(tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)))-
681 continue;-
682 break;-
683 case PseudoElement_TitleBarContextHelpButton:-
684 if (!(tb->titleBarFlags & Qt::WindowContextHelpButtonHint))-
685 continue;-
686 break;-
687 case PseudoElement_TitleBarMinButton:-
688 if (!(tb->titleBarFlags & Qt::WindowMinimizeButtonHint))-
689 continue;-
690 if (isMinimized)-
691 info.element = PseudoElement_TitleBarNormalButton;-
692 break;-
693 case PseudoElement_TitleBarMaxButton:-
694 if (!(tb->titleBarFlags & Qt::WindowMaximizeButtonHint))-
695 continue;-
696 if (isMaximized)-
697 info.element = PseudoElement_TitleBarNormalButton;-
698 break;-
699 case PseudoElement_TitleBarShadeButton:-
700 if (!(tb->titleBarFlags & Qt::WindowShadeButtonHint))-
701 continue;-
702 if (isMinimized)-
703 info.element = PseudoElement_TitleBarUnshadeButton;-
704 break;-
705 case PseudoElement_TitleBarCloseButton:-
706 case PseudoElement_TitleBarSysMenu:-
707 if (!(tb->titleBarFlags & Qt::WindowSystemMenuHint))-
708 continue;-
709 break;-
710 default:-
711 continue;-
712 }-
713 if (info.element == PseudoElement_TitleBar) {-
714 info.width = tb->fontMetrics.width(tb->text) + 6;-
715 subRule.geo = new QStyleSheetGeometryData(info.width, tb->fontMetrics.height(), -1, -1, -1, -1);-
716 } else {-
717 subRule = renderRule(w, tb, info.element);-
718 info.width = subRule.size().width();-
719 }-
720 info.rule = subRule;-
721 info.offset = offsets[where];-
722 info.where = where;-
723 infos.append(std::move(info));-
724-
725 offsets[where] += info.width;-
726 }-
727 }-
728-
729 for (int i = 0; i < infos.size(); i++) {-
730 const ButtonInfo &info = infos[i];-
731 QRect lr = cr;-
732 switch (info.where) {-
733 case Center: {-
734 lr.setLeft(cr.left() + offsets[Left]);-
735 lr.setRight(cr.right() - offsets[Right]);-
736 QRect r(0, 0, offsets[Center], lr.height());-
737 r.moveCenter(lr.center());-
738 r.setLeft(r.left()+info.offset);-
739 r.setWidth(info.width);-
740 lr = r;-
741 break; }-
742 case Left:-
743 lr.translate(info.offset, 0);-
744 lr.setWidth(info.width);-
745 break;-
746 case Right:-
747 lr.moveLeft(cr.right() + 1 - offsets[Right] + info.offset);-
748 lr.setWidth(info.width);-
749 break;-
750 default:-
751 break;-
752 }-
753 QStyle::SubControl control = knownPseudoElements[info.element].subControl;-
754 layoutRects[control] = positionRect(w, info.rule, info.element, lr, tb->direction);-
755 }-
756-
757 return layoutRects;-
758}-
759-
760static QStyle::StandardPixmap subControlIcon(int pe)-
761{-
762 switch (pe) {-
763 case PseudoElement_MdiCloseButton: return QStyle::SP_TitleBarCloseButton;-
764 case PseudoElement_MdiMinButton: return QStyle::SP_TitleBarMinButton;-
765 case PseudoElement_MdiNormalButton: return QStyle::SP_TitleBarNormalButton;-
766 case PseudoElement_TitleBarCloseButton: return QStyle::SP_TitleBarCloseButton;-
767 case PseudoElement_TitleBarMinButton: return QStyle::SP_TitleBarMinButton;-
768 case PseudoElement_TitleBarMaxButton: return QStyle::SP_TitleBarMaxButton;-
769 case PseudoElement_TitleBarShadeButton: return QStyle::SP_TitleBarShadeButton;-
770 case PseudoElement_TitleBarUnshadeButton: return QStyle::SP_TitleBarUnshadeButton;-
771 case PseudoElement_TitleBarNormalButton: return QStyle::SP_TitleBarNormalButton;-
772 case PseudoElement_TitleBarContextHelpButton: return QStyle::SP_TitleBarContextHelpButton;-
773 default: break;-
774 }-
775 return QStyle::SP_CustomBase;-
776}-
777-
778QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject *object)-
779: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)-
780{-
781 QPalette palette = QApplication::palette();-
782 ValueExtractor v(declarations, palette);-
783 features = v.extractStyleFeatures();-
784-
785 int w = -1, h = -1, minw = -1, minh = -1, maxw = -1, maxh = -1;-
786 if (v.extractGeometry(&w, &h, &minw, &minh, &maxw, &maxh))-
787 geo = new QStyleSheetGeometryData(w, h, minw, minh, maxw, maxh);-
788-
789 int left = 0, top = 0, right = 0, bottom = 0;-
790 Origin origin = Origin_Unknown;-
791 Qt::Alignment position = 0;-
792 QCss::PositionMode mode = PositionMode_Unknown;-
793 Qt::Alignment textAlignment = 0;-
794 if (v.extractPosition(&left, &top, &right, &bottom, &origin, &position, &mode, &textAlignment))-
795 p = new QStyleSheetPositionData(left, top, right, bottom, origin, position, mode, textAlignment);-
796-
797 int margins[4], paddings[4], spacing = -1;-
798 for (int i = 0; i < 4; i++)-
799 margins[i] = paddings[i] = 0;-
800 if (v.extractBox(margins, paddings, &spacing))-
801 b = new QStyleSheetBoxData(margins, paddings, spacing);-
802-
803 int borders[4];-
804 QBrush colors[4];-
805 QCss::BorderStyle styles[4];-
806 QSize radii[4];-
807 for (int i = 0; i < 4; i++) {-
808 borders[i] = 0;-
809 styles[i] = BorderStyle_None;-
810 }-
811 if (v.extractBorder(borders, colors, styles, radii))-
812 bd = new QStyleSheetBorderData(borders, colors, styles, radii);-
813-
814 int offsets[4];-
815 for (int i = 0; i < 4; i++) {-
816 borders[i] = offsets[i] = 0;-
817 styles[i] = BorderStyle_None;-
818 }-
819 if (v.extractOutline(borders, colors, styles, radii, offsets))-
820 ou = new QStyleSheetOutlineData(borders, colors, styles, radii, offsets);-
821-
822 QBrush brush;-
823 QString uri;-
824 Repeat repeat = Repeat_XY;-
825 Qt::Alignment alignment = Qt::AlignTop | Qt::AlignLeft;-
826 Attachment attachment = Attachment_Scroll;-
827 origin = Origin_Padding;-
828 Origin clip = Origin_Border;-
829 if (v.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip))-
830 bg = new QStyleSheetBackgroundData(brush, QPixmap(uri), repeat, alignment, origin, attachment, clip);-
831-
832 QBrush sfg, fg;-
833 QBrush sbg, abg;-
834 if (v.extractPalette(&fg, &sfg, &sbg, &abg))-
835 pal = new QStyleSheetPaletteData(fg, sfg, sbg, abg);-
836-
837 QIcon icon;-
838 alignment = Qt::AlignCenter;-
839 QSize size;-
840 if (v.extractImage(&icon, &alignment, &size))-
841 img = new QStyleSheetImageData(icon, alignment, size);-
842-
843 int adj = -255;-
844 hasFont = v.extractFont(&font, &adj);-
845-
846-
847 if (object && qstrcmp(object->metaObject()->className(), "QTipLabel") == 0)-
848 palette = QToolTip::palette();-
849-
850-
851 for (int i = 0; i < declarations.count(); i++) {-
852 const Declaration& decl = declarations.at(i);-
853 if (decl.d->propertyId == BorderImage) {-
854 QString uri;-
855 QCss::TileMode horizStretch, vertStretch;-
856 int cuts[4];-
857-
858 decl.borderImageValue(&uri, cuts, &horizStretch, &vertStretch);-
859 if (uri.isEmpty() || uri == QLatin1String("none")) {-
860 if (bd && bd->bi)-
861 bd->bi->pixmap = QPixmap();-
862 } else {-
863 if (!bd)-
864 bd = new QStyleSheetBorderData;-
865 if (!bd->bi)-
866 bd->bi = new QStyleSheetBorderImageData;-
867-
868 QStyleSheetBorderImageData *bi = bd->bi;-
869 bi->pixmap = QPixmap(uri);-
870 for (int i = 0; i < 4; i++)-
871 bi->cuts[i] = cuts[i];-
872 bi->horizStretch = horizStretch;-
873 bi->vertStretch = vertStretch;-
874 }-
875 } else if (decl.d->propertyId == QtBackgroundRole) {-
876 if (bg && bg->brush.style() != Qt::NoBrush)-
877 continue;-
878 int role = decl.d->values.at(0).variant.toInt();-
879 if (role >= Value_FirstColorRole && role <= Value_LastColorRole)-
880 defaultBackground = palette.color((QPalette::ColorRole)(role-Value_FirstColorRole));-
881 } else if (decl.d->property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive)) {-
882-
883 } else if (decl.d->propertyId == UnknownProperty) {-
884 bool knownStyleHint = false;-
885 for (int i = 0; i < numKnownStyleHints; i++) {-
886 QLatin1String styleHint(knownStyleHints[i]);-
887 if (decl.d->property.compare(styleHint) == 0) {-
888 QString hintName = QString(styleHint);-
889 QVariant hintValue;-
890 if (hintName.endsWith(QLatin1String("alignment"))) {-
891 hintValue = (int) decl.alignmentValue();-
892 } else if (hintName.endsWith(QLatin1String("color"))) {-
893 hintValue = (int) decl.colorValue().rgba();-
894 } else if (hintName.endsWith(QLatin1String("size"))) {-
895 hintValue = decl.sizeValue();-
896 } else if (hintName.endsWith(QLatin1String("icon"))) {-
897 hintValue = decl.iconValue();-
898 } else if (hintName == QLatin1String("button-layout")-
899 && decl.d->values.count() != 0 && decl.d->values.at(0).type == Value::String) {-
900 hintValue = subControlLayout(decl.d->values.at(0).variant.toString());-
901 } else {-
902 int integer;-
903 decl.intValue(&integer);-
904 hintValue = integer;-
905 }-
906 styleHints[decl.d->property] = hintValue;-
907 knownStyleHint = true;-
908 break;-
909 }-
910 }-
911 if (!knownStyleHint)-
912 QMessageLogger(__FILE__, 9951001, __PRETTY_FUNCTION__).debug("Unknown property %s", QString(decl.d->property).toLocal8Bit().constData());-
913 }-
914 }-
915-
916 if (hasBorder()) {-
917 if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {-
918 QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);-
919 if (!style)-
920 style = qobject_cast<QStyleSheetStyle *>(widget->style());-
921 if (style)-
922 fixupBorder(style->nativeFrameWidth(widget));-
923 }-
924 if (border()->hasBorderImage())-
925 defaultBackground = QBrush();-
926 }-
927}-
928-
929QRect QRenderRule::borderRect(const QRect& r) const-
930{-
931 if (!hasBox())-
932 return r;-
933 const int* m = box()->margins;-
934 return r.adjusted(m[LeftEdge], m[TopEdge], -m[RightEdge], -m[BottomEdge]);-
935}-
936-
937QRect QRenderRule::outlineRect(const QRect& r) const-
938{-
939 QRect br = borderRect(r);-
940 if (!hasOutline())-
941 return br;-
942 const int *b = outline()->borders;-
943 return r.adjusted(b[LeftEdge], b[TopEdge], -b[RightEdge], -b[BottomEdge]);-
944}-
945-
946QRect QRenderRule::paddingRect(const QRect& r) const-
947{-
948 QRect br = borderRect(r);-
949 if (!hasBorder())-
950 return br;-
951 const int *b = border()->borders;-
952 return br.adjusted(b[LeftEdge], b[TopEdge], -b[RightEdge], -b[BottomEdge]);-
953}-
954-
955QRect QRenderRule::contentsRect(const QRect& r) const-
956{-
957 QRect pr = paddingRect(r);-
958 if (!hasBox())-
959 return pr;-
960 const int *p = box()->paddings;-
961 return pr.adjusted(p[LeftEdge], p[TopEdge], -p[RightEdge], -p[BottomEdge]);-
962}-
963-
964QRect QRenderRule::boxRect(const QRect& cr, int flags) const-
965{-
966 QRect r = cr;-
967 if (hasBox()) {-
968 if (flags & Margin) {-
969 const int *m = box()->margins;-
970 r.adjust(-m[LeftEdge], -m[TopEdge], m[RightEdge], m[BottomEdge]);-
971 }-
972 if (flags & Padding) {-
973 const int *p = box()->paddings;-
974 r.adjust(-p[LeftEdge], -p[TopEdge], p[RightEdge], p[BottomEdge]);-
975 }-
976 }-
977 if (hasBorder() && (flags & Border)) {-
978 const int *b = border()->borders;-
979 r.adjust(-b[LeftEdge], -b[TopEdge], b[RightEdge], b[BottomEdge]);-
980 }-
981 return r;-
982}-
983-
984QSize QRenderRule::boxSize(const QSize &cs, int flags) const-
985{-
986 QSize bs = boxRect(QRect(QPoint(0, 0), cs), flags).size();-
987 if (cs.width() < 0) bs.setWidth(-1);-
988 if (cs.height() < 0) bs.setHeight(-1);-
989 return bs;-
990}-
991-
992void QRenderRule::fixupBorder(int nativeWidth)-
993{-
994 if (bd == 0)-
995 return;-
996-
997 if (!bd->hasBorderImage() || bd->bi->pixmap.isNull()) {-
998 bd->bi = 0;-
999-
1000 QBrush color = pal ? pal->foreground : QBrush();-
1001 const bool hasRadius = bd->radii[0].isValid() || bd->radii[1].isValid()-
1002 || bd->radii[2].isValid() || bd->radii[3].isValid();-
1003 for (int i = 0; i < 4; i++) {-
1004 if ((bd->styles[i] == BorderStyle_Native) && hasRadius)-
1005 bd->styles[i] = BorderStyle_None;-
1006-
1007 switch (bd->styles[i]) {-
1008 case BorderStyle_None:-
1009-
1010 bd->colors[i] = QBrush();-
1011 bd->borders[i] = 0;-
1012 break;-
1013 case BorderStyle_Native:-
1014 if (bd->borders[i] == 0)-
1015 bd->borders[i] = nativeWidth;-
1016-
1017 default:-
1018 if (bd->colors[i].style() == Qt::NoBrush)-
1019 bd->colors[i] = color;-
1020 break;-
1021 }-
1022 }-
1023-
1024 return;-
1025 }-
1026-
1027-
1028 QStyleSheetBorderImageData *bi = bd->bi;-
1029 if (bi->cuts[0] == -1) {-
1030 for (int i = 0; i < 4; i++)-
1031 bi->cuts[i] = int(border()->borders[i]);-
1032 }-
1033}-
1034-
1035void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect)-
1036{-
1037 setClip(p, rect);-
1038 static const Qt::TileRule tileMode2TileRule[] = {-
1039 Qt::StretchTile, Qt::RoundTile, Qt::StretchTile, Qt::RepeatTile, Qt::StretchTile };-
1040-
1041 const QStyleSheetBorderImageData *borderImageData = border()->borderImage();-
1042 const int *targetBorders = border()->borders;-
1043 const int *sourceBorders = borderImageData->cuts;-
1044 QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge],-
1045 sourceBorders[RightEdge], sourceBorders[BottomEdge]);-
1046 QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge],-
1047 targetBorders[RightEdge], targetBorders[BottomEdge]);-
1048-
1049 bool wasSmoothPixmapTransform = p->renderHints() & QPainter::SmoothPixmapTransform;-
1050 p->setRenderHint(QPainter::SmoothPixmapTransform);-
1051 qDrawBorderPixmap(p, rect, targetMargins, borderImageData->pixmap,-
1052 QRect(QPoint(), borderImageData->pixmap.size()), sourceMargins,-
1053 QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch]));-
1054 p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform);-
1055 unsetClip(p);-
1056}-
1057-
1058QRect QRenderRule::originRect(const QRect &rect, Origin origin) const-
1059{-
1060 switch (origin) {-
1061 case Origin_Padding:-
1062 return paddingRect(rect);-
1063 case Origin_Border:-
1064 return borderRect(rect);-
1065 case Origin_Content:-
1066 return contentsRect(rect);-
1067 case Origin_Margin:-
1068 default:-
1069 return rect;-
1070 }-
1071}-
1072-
1073void QRenderRule::drawBackgroundImage(QPainter *p, const QRect &rect, QPoint off)-
1074{-
1075 if (!hasBackground())-
1076 return;-
1077-
1078 const QPixmap& bgp = background()->pixmap;-
1079 if (bgp.isNull())-
1080 return;-
1081-
1082 setClip(p, borderRect(rect));-
1083-
1084 if (background()->origin != background()->clip) {-
1085 p->save();-
1086 p->setClipRect(originRect(rect, background()->clip), Qt::IntersectClip);-
1087 }-
1088-
1089 if (background()->attachment == Attachment_Fixed)-
1090 off = QPoint(0, 0);-
1091-
1092 QRect r = originRect(rect, background()->origin);-
1093 QRect aligned = QStyle::alignedRect(Qt::LeftToRight, background()->position, bgp.size(), r);-
1094 QRect inter = aligned.translated(-off).intersected(r);-
1095-
1096 switch (background()->repeat) {-
1097 case Repeat_Y:-
1098 p->drawTiledPixmap(inter.x(), r.y(), inter.width(), r.height(), bgp,-
1099 inter.x() - aligned.x() + off.x(),-
1100 bgp.height() - int(aligned.y() - r.y()) % bgp.height() + off.y());-
1101 break;-
1102 case Repeat_X:-
1103 p->drawTiledPixmap(r.x(), inter.y(), r.width(), inter.height(), bgp,-
1104 bgp.width() - int(aligned.x() - r.x())%bgp.width() + off.x(),-
1105 inter.y() - aligned.y() + off.y());-
1106 break;-
1107 case Repeat_XY:-
1108 p->drawTiledPixmap(r, bgp,-
1109 QPoint(bgp.width() - int(aligned.x() - r.x())% bgp.width() + off.x(),-
1110 bgp.height() - int(aligned.y() - r.y())%bgp.height() + off.y()));-
1111 break;-
1112 case Repeat_None:-
1113 default:-
1114 p->drawPixmap(inter.x(), inter.y(), bgp, inter.x() - aligned.x() + off.x(),-
1115 inter.y() - aligned.y() + off.y(), inter.width(), inter.height());-
1116 break;-
1117 }-
1118-
1119-
1120 if (background()->origin != background()->clip)-
1121 p->restore();-
1122-
1123 unsetClip(p);-
1124}-
1125-
1126void QRenderRule::drawOutline(QPainter *p, const QRect &rect)-
1127{-
1128 if (!hasOutline())-
1129 return;-
1130-
1131 bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;-
1132 p->setRenderHint(QPainter::Antialiasing);-
1133 qDrawBorder(p, rect, ou->styles, ou->borders, ou->colors, ou->radii);-
1134 p->setRenderHint(QPainter::Antialiasing, wasAntialiased);-
1135}-
1136-
1137void QRenderRule::drawBorder(QPainter *p, const QRect& rect)-
1138{-
1139 if (!hasBorder())-
1140 return;-
1141-
1142 if (border()->hasBorderImage()) {-
1143 drawBorderImage(p, rect);-
1144 return;-
1145 }-
1146-
1147 bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;-
1148 p->setRenderHint(QPainter::Antialiasing);-
1149 qDrawBorder(p, rect, bd->styles, bd->borders, bd->colors, bd->radii);-
1150 p->setRenderHint(QPainter::Antialiasing, wasAntialiased);-
1151}-
1152-
1153QPainterPath QRenderRule::borderClip(QRect r)-
1154{-
1155 if (!hasBorder())-
1156 return QPainterPath();-
1157-
1158 QSize tlr, trr, blr, brr;-
1159 qNormalizeRadii(r, bd->radii, &tlr, &trr, &blr, &brr);-
1160 if (tlr.isNull() && trr.isNull() && blr.isNull() && brr.isNull())-
1161 return QPainterPath();-
1162-
1163 const QRectF rect(r);-
1164 const int *borders = border()->borders;-
1165 QPainterPath path;-
1166 qreal curY = rect.y() + borders[TopEdge]/2.0;-
1167 path.moveTo(rect.x() + tlr.width(), curY);-
1168 path.lineTo(rect.right() - trr.width(), curY);-
1169 qreal curX = rect.right() - borders[RightEdge]/2.0;-
1170 path.arcTo(curX - 2*trr.width() + borders[RightEdge], curY,-
1171 trr.width()*2 - borders[RightEdge], trr.height()*2 - borders[TopEdge], 90, -90);-
1172-
1173 path.lineTo(curX, rect.bottom() - brr.height());-
1174 curY = rect.bottom() - borders[BottomEdge]/2.0;-
1175 path.arcTo(curX - 2*brr.width() + borders[RightEdge], curY - 2*brr.height() + borders[BottomEdge],-
1176 brr.width()*2 - borders[RightEdge], brr.height()*2 - borders[BottomEdge], 0, -90);-
1177-
1178 path.lineTo(rect.x() + blr.width(), curY);-
1179 curX = rect.left() + borders[LeftEdge]/2.0;-
1180 path.arcTo(curX, rect.bottom() - 2*blr.height() + borders[BottomEdge]/2,-
1181 blr.width()*2 - borders[LeftEdge], blr.height()*2 - borders[BottomEdge], 270, -90);-
1182-
1183 path.lineTo(curX, rect.top() + tlr.height());-
1184 path.arcTo(curX, rect.top() + borders[TopEdge]/2,-
1185 tlr.width()*2 - borders[LeftEdge], tlr.height()*2 - borders[TopEdge], 180, -90);-
1186-
1187 path.closeSubpath();-
1188 return path;-
1189}-
1190-
1191-
1192-
1193-
1194void QRenderRule::setClip(QPainter *p, const QRect &rect)-
1195{-
1196 if (clipset++)-
1197 return;-
1198 clipPath = borderClip(rect);-
1199 if (!clipPath.isEmpty()) {-
1200 p->save();-
1201 p->setClipPath(clipPath, Qt::IntersectClip);-
1202 }-
1203}-
1204-
1205void QRenderRule::unsetClip(QPainter *p)-
1206{-
1207 if (--clipset)-
1208 return;-
1209 if (!clipPath.isEmpty())-
1210 p->restore();-
1211}-
1212-
1213void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off)-
1214{-
1215 QBrush brush = hasBackground() ? background()->brush : QBrush();-
1216 if (brush.style() == Qt::NoBrush)-
1217 brush = defaultBackground;-
1218-
1219 if (brush.style() != Qt::NoBrush) {-
1220 Origin origin = hasBackground() ? background()->clip : Origin_Border;-
1221-
1222 const QPainterPath &borderPath = borderClip(originRect(rect, origin));-
1223 if (!borderPath.isEmpty()) {-
1224-
1225 bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;-
1226 p->setRenderHint(QPainter::Antialiasing);-
1227 p->fillPath(borderPath, brush);-
1228 p->setRenderHint(QPainter::Antialiasing, wasAntialiased);-
1229 } else {-
1230 p->fillRect(originRect(rect, origin), brush);-
1231 }-
1232 }-
1233-
1234 drawBackgroundImage(p, rect, off);-
1235}-
1236-
1237void QRenderRule::drawFrame(QPainter *p, const QRect& rect)-
1238{-
1239 drawBackground(p, rect);-
1240 if (hasBorder())-
1241 drawBorder(p, borderRect(rect));-
1242}-
1243-
1244void QRenderRule::drawImage(QPainter *p, const QRect &rect)-
1245{-
1246 if (!hasImage())-
1247 return;-
1248 img->icon.paint(p, rect, img->alignment);-
1249}-
1250-
1251void QRenderRule::drawRule(QPainter *p, const QRect& rect)-
1252{-
1253 drawFrame(p, rect);-
1254 drawImage(p, contentsRect(rect));-
1255}-
1256-
1257-
1258void QRenderRule::configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette::ColorRole br)-
1259{-
1260 if (bg && bg->brush.style() != Qt::NoBrush) {-
1261 if (br != QPalette::NoRole)-
1262 p->setBrush(br, bg->brush);-
1263 p->setBrush(QPalette::Window, bg->brush);-
1264 if (bg->brush.style() == Qt::SolidPattern) {-
1265 p->setBrush(QPalette::Light, bg->brush.color().lighter(115));-
1266 p->setBrush(QPalette::Midlight, bg->brush.color().lighter(107));-
1267 p->setBrush(QPalette::Dark, bg->brush.color().darker(150));-
1268 p->setBrush(QPalette::Shadow, bg->brush.color().darker(300));-
1269 }-
1270 }-
1271-
1272 if (!hasPalette())-
1273 return;-
1274-
1275 if (pal->foreground.style() != Qt::NoBrush) {-
1276 if (fr != QPalette::NoRole)-
1277 p->setBrush(fr, pal->foreground);-
1278 p->setBrush(QPalette::WindowText, pal->foreground);-
1279 p->setBrush(QPalette::Text, pal->foreground);-
1280 }-
1281 if (pal->selectionBackground.style() != Qt::NoBrush)-
1282 p->setBrush(QPalette::Highlight, pal->selectionBackground);-
1283 if (pal->selectionForeground.style() != Qt::NoBrush)-
1284 p->setBrush(QPalette::HighlightedText, pal->selectionForeground);-
1285 if (pal->alternateBackground.style() != Qt::NoBrush)-
1286 p->setBrush(QPalette::AlternateBase, pal->alternateBackground);-
1287}-
1288-
1289void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const QWidget *w, bool embedded)-
1290{-
1291 if (bg && bg->brush.style() != Qt::NoBrush) {-
1292 p->setBrush(cg, QPalette::Base, bg->brush);-
1293 p->setBrush(cg, QPalette::Button, bg->brush);-
1294 p->setBrush(cg, w->backgroundRole(), bg->brush);-
1295 p->setBrush(cg, QPalette::Window, bg->brush);-
1296 }-
1297-
1298 if (embedded) {-
1299-
1300-
1301 if ((hasBackground() && background()->isTransparent())-
1302 || (hasBorder() && border()->hasBorderImage() && !border()->borderImage()->pixmap.isNull()))-
1303 p->setBrush(cg, w->backgroundRole(), Qt::NoBrush);-
1304 }-
1305-
1306 if (!hasPalette())-
1307 return;-
1308-
1309 if (pal->foreground.style() != Qt::NoBrush) {-
1310 p->setBrush(cg, QPalette::ButtonText, pal->foreground);-
1311 p->setBrush(cg, w->foregroundRole(), pal->foreground);-
1312 p->setBrush(cg, QPalette::WindowText, pal->foreground);-
1313 p->setBrush(cg, QPalette::Text, pal->foreground);-
1314 }-
1315 if (pal->selectionBackground.style() != Qt::NoBrush)-
1316 p->setBrush(cg, QPalette::Highlight, pal->selectionBackground);-
1317 if (pal->selectionForeground.style() != Qt::NoBrush)-
1318 p->setBrush(cg, QPalette::HighlightedText, pal->selectionForeground);-
1319 if (pal->alternateBackground.style() != Qt::NoBrush)-
1320 p->setBrush(cg, QPalette::AlternateBase, pal->alternateBackground);-
1321}-
1322-
1323-
1324-
1325-
1326-
1327static inline QObject *parentObject(const QObject *obj)-
1328{-
1329 if (qobject_cast<const QLabel *>(obj) && qstrcmp(obj->metaObject()->className(), "QTipLabel") == 0) {-
1330 QObject *p = qvariant_cast<QObject *>(obj->property("_q_stylesheet_parent"));-
1331 if (p)-
1332 return p;-
1333 }-
1334 return obj->parent();-
1335}-
1336-
1337class QStyleSheetStyleSelector : public StyleSelector-
1338{-
1339public:-
1340 QStyleSheetStyleSelector() { }-
1341-
1342 QStringList nodeNames(NodePtr node) const override-
1343 {-
1344 if (isNullNode(node))-
1345 return QStringList();-
1346 const QMetaObject *metaObject = (static_cast<QObject *>(node.ptr))->metaObject();-
1347-
1348 if (qstrcmp(metaObject->className(), "QTipLabel") == 0)-
1349 return QStringList(QLatin1String("QToolTip"));-
1350-
1351 QStringList result;-
1352 do {-
1353 result += QString::fromLatin1(metaObject->className()).replace(QLatin1Char(':'), QLatin1Char('-'));-
1354 metaObject = metaObject->superClass();-
1355 } while (metaObject != 0);-
1356 return result;-
1357 }-
1358 QString attribute(NodePtr node, const QString& name) const override-
1359 {-
1360 if (isNullNode(node))-
1361 return QString();-
1362-
1363 QHash<QString, QString> &cache = m_attributeCache[(static_cast<QObject *>(node.ptr))];-
1364 QHash<QString, QString>::const_iterator cacheIt = cache.constFind(name);-
1365 if (cacheIt != cache.constEnd())-
1366 return cacheIt.value();-
1367-
1368 QObject *obj = (static_cast<QObject *>(node.ptr));-
1369 QVariant value = obj->property(name.toLatin1());-
1370 if (!value.isValid()) {-
1371 if (name == QLatin1String("class")) {-
1372 QString className = QString::fromLatin1(obj->metaObject()->className());-
1373 if (className.contains(QLatin1Char(':')))-
1374 className.replace(QLatin1Char(':'), QLatin1Char('-'));-
1375 cache[name] = className;-
1376 return className;-
1377 } else if (name == QLatin1String("style")) {-
1378 QWidget *w = qobject_cast<QWidget *>(obj);-
1379 QStyleSheetStyle *proxy = w ? qobject_cast<QStyleSheetStyle *>(w->style()) : 0;-
1380 if (proxy) {-
1381 QString styleName = QString::fromLatin1(proxy->baseStyle()->metaObject()->className());-
1382 cache[name] = styleName;-
1383 return styleName;-
1384 }-
1385 }-
1386 }-
1387 QString valueStr;-
1388 if(value.type() == QVariant::StringList || value.type() == QVariant::List)-
1389 valueStr = value.toStringList().join(QLatin1Char(' '));-
1390 else-
1391 valueStr = value.toString();-
1392 cache[name] = valueStr;-
1393 return valueStr;-
1394 }-
1395 bool nodeNameEquals(NodePtr node, const QString& nodeName) const override-
1396 {-
1397 if (isNullNode(node))-
1398 return false;-
1399 const QMetaObject *metaObject = (static_cast<QObject *>(node.ptr))->metaObject();-
1400-
1401 if (qstrcmp(metaObject->className(), "QTipLabel") == 0)-
1402 return nodeName == QLatin1String("QToolTip");-
1403-
1404 do {-
1405 const ushort *uc = (const ushort *)nodeName.constData();-
1406 const ushort *e = uc + nodeName.length();-
1407 const uchar *c = (const uchar *)metaObject->className();-
1408 while (*c && uc != e && (*uc == *c || (*c == ':' && *uc == '-'))) {-
1409 ++uc;-
1410 ++c;-
1411 }-
1412 if (uc == e && !*c)-
1413 return true;-
1414 metaObject = metaObject->superClass();-
1415 } while (metaObject != 0);-
1416 return false;-
1417 }-
1418 bool hasAttributes(NodePtr) const override-
1419 { return true; }-
1420 QStringList nodeIds(NodePtr node) const override-
1421 { return isNullNode(node) ? QStringList() : QStringList((static_cast<QObject *>(node.ptr))->objectName()); }-
1422 bool isNullNode(NodePtr node) const override-
1423 { return node.ptr == 0; }-
1424 NodePtr parentNode(NodePtr node) const override-
1425 { NodePtr n; n.ptr = isNullNode(node) ? 0 : parentObject((static_cast<QObject *>(node.ptr))); return n; }-
1426 NodePtr previousSiblingNode(NodePtr) const override-
1427 { NodePtr n; n.ptr = 0; return n; }-
1428 NodePtr duplicateNode(NodePtr node) const override-
1429 { return node; }-
1430 void freeNode(NodePtr) const override-
1431 { }-
1432-
1433private:-
1434 mutable QHash<const QObject *, QHash<QString, QString> > m_attributeCache;-
1435};-
1436-
1437QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QObject *obj) const-
1438{-
1439 QHash<const QObject *, QVector<StyleRule> >::const_iterator cacheIt = styleSheetCaches->styleRulesCache.constFind(obj);-
1440 if (cacheIt != styleSheetCaches->styleRulesCache.constEnd()
cacheIt != sty...che.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1441 return
never executed: return cacheIt.value();
cacheIt.value();
never executed: return cacheIt.value();
0
1442-
1443 if (!initObject(obj)
!initObject(obj)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1444 return
never executed: return QVector<StyleRule>();
QVector<StyleRule>();
never executed: return QVector<StyleRule>();
0
1445 }-
1446-
1447 QStyleSheetStyleSelector styleSelector;-
1448-
1449 StyleSheet defaultSs;-
1450 QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCaches->styleSheetCache.constFind(baseStyle());-
1451 if (defaultCacheIt == styleSheetCaches->styleSheetCache.constEnd()
defaultCacheIt...che.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1452 defaultSs = getDefaultStyleSheet();-
1453 QStyle *bs = baseStyle();-
1454 styleSheetCaches->styleSheetCache.insert(bs, defaultSs);-
1455 QObject::connect(bs, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "1538""1544"), styleSheetCaches, qFlagLocation("1""styleDestroyed(QObject*)" "\0" __FILE__ ":" "1538""1544"), Qt::UniqueConnection);-
1456 }
never executed: end of block
else {
0
1457 defaultSs = defaultCacheIt.value();-
1458 }
never executed: end of block
0
1459 styleSelector.styleSheets += defaultSs;-
1460-
1461 if (!(static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet().isEmpty()
!(static_cast<...et().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1462 StyleSheet appSs;-
1463 QHash<const void *, StyleSheet>::const_iterator appCacheIt = styleSheetCaches->styleSheetCache.constFind((static_cast<QApplication *>(QCoreApplication::instance())));-
1464 if (appCacheIt == styleSheetCaches->styleSheetCache.constEnd()
appCacheIt == ...che.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1465 QString ss = (static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet();-
1466 if (ss.startsWith(QLatin1String("file:///"))
ss.startsWith(...g("file:///"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1467 ss.remove(0, 8);
never executed: ss.remove(0, 8);
0
1468 parser.init(ss, (static_cast<QApplication *>(QCoreApplication::instance()))->styleSheet() != ss);-
1469 if (!(__builtin_expect(!!(!
__builtin_expe...ppSs)), false)Description
TRUEnever evaluated
FALSEnever evaluated
parser.parse(&appSs)), false)
__builtin_expe...ppSs)), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1470 QMessageLogger(__FILE__, 15531559, __PRETTY_FUNCTION__).warning("Could not parse application stylesheet");
never executed: QMessageLogger(__FILE__, 1559, __PRETTY_FUNCTION__).warning("Could not parse application stylesheet");
0
1471 appSs.origin = StyleSheetOrigin_Inline;-
1472 appSs.depth = 1;-
1473 styleSheetCaches->styleSheetCache.insert((static_cast<QApplication *>(QCoreApplication::instance())), appSs);-
1474 }
never executed: end of block
else {
0
1475 appSs = appCacheIt.value();-
1476 }
never executed: end of block
0
1477 styleSelector.styleSheets += appSs;-
1478 }
never executed: end of block
0
1479-
1480 QVector<QCss::StyleSheet> objectSs;-
1481 for (const QObject *o = obj; o
oDescription
TRUEnever evaluated
FALSEnever evaluated
; o = parentObject(o)) {
0
1482 QString styleSheet = o->property("styleSheet").toString();-
1483 if (styleSheet.isEmpty()
styleSheet.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1484 continue;
never executed: continue;
0
1485 StyleSheet ss;-
1486 QHash<const void *, StyleSheet>::const_iterator objCacheIt = styleSheetCaches->styleSheetCache.constFind(o);-
1487 if (objCacheIt == styleSheetCaches->styleSheetCache.constEnd()
objCacheIt == ...che.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1488 parser.init(styleSheet);-
1489 if (!parser.parse(&ss)
!parser.parse(&ss)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1490 parser.init(QLatin1String("* {") + styleSheet + QLatin1Char('}'));-
1491 if (!(__builtin_expect(!!(!
__builtin_expe...(&ss)), false)Description
TRUEnever evaluated
FALSEnever evaluated
parser.parse(&ss)), false)
__builtin_expe...(&ss)), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1492 QMessageLogger(__FILE__, 15751581, __PRETTY_FUNCTION__).warning("Could not parse stylesheet of object %p", o);
never executed: QMessageLogger(__FILE__, 1581, __PRETTY_FUNCTION__).warning("Could not parse stylesheet of object %p", o);
0
1493 }
never executed: end of block
0
1494 ss.origin = StyleSheetOrigin_Inline;-
1495 styleSheetCaches->styleSheetCache.insert(o, ss);-
1496 }
never executed: end of block
else {
0
1497 ss = objCacheIt.value();-
1498 }
never executed: end of block
0
1499 objectSs.append(ss);-
1500 }
never executed: end of block
0
1501-
1502 for (int i = 0; i < objectSs.count()
i < objectSs.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
1503 objectSs[i].depth = objectSs.count() - i + 2;
never executed: objectSs[i].depth = objectSs.count() - i + 2;
0
1504-
1505 styleSelector.styleSheets += objectSs;-
1506-
1507 StyleSelector::NodePtr n;-
1508 n.ptr = const_cast<QObject *>(obj);-
1509 QVector<QCss::StyleRule> rules = styleSelector.styleRulesForNode(n);-
1510 styleSheetCaches->styleRulesCache.insert(obj, rules);-
1511 return
never executed: return rules;
rules;
never executed: return rules;
0
1512}-
1513-
1514-
1515-
1516static QVector<Declaration> declarations(const QVector<StyleRule> &styleRules, const QString &part, quint64 pseudoClass = PseudoClass_Unspecified)-
1517{-
1518 QVector<Declaration> decls;-
1519 for (int i = 0; i < styleRules.count(); i++) {-
1520 const Selector& selector = styleRules.at(i).selectors.at(0);-
1521-
1522-
1523 if (part.compare(selector.pseudoElement(), Qt::CaseInsensitive) != 0)-
1524 continue;-
1525 quint64 negated = 0;-
1526 quint64 cssClass = selector.pseudoClass(&negated);-
1527 if ((pseudoClass == PseudoClass_Any) || (cssClass == PseudoClass_Unspecified)-
1528 || ((((cssClass & pseudoClass) == cssClass)) && ((negated & pseudoClass) == 0)))-
1529 decls += styleRules.at(i).declarations;-
1530 }-
1531 return decls;-
1532}-
1533-
1534int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)-
1535{-
1536 QStyle *base = baseStyle();-
1537-
1538-
1539 if (qobject_cast<const QAbstractSpinBox *>(w))-
1540 return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w);-
1541-
1542-
1543-
1544 if (qobject_cast<const QComboBox *>(w))-
1545 return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w);-
1546-
1547-
1548-
1549 if (qobject_cast<const QMenu *>(w))-
1550 return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);-
1551-
1552-
1553-
1554 if (qobject_cast<const QMenuBar *>(w))-
1555 return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w);-
1556-
1557-
1558 if (const QFrame *frame = qobject_cast<const QFrame *>(w)) {-
1559 if (frame->frameShape() == QFrame::NoFrame)-
1560 return 0;-
1561 }-
1562-
1563-
1564 if (qstrcmp(w->metaObject()->className(), "QTipLabel") == 0)-
1565 return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, w);-
1566-
1567 return base->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, w);-
1568}-
1569-
1570static quint64 pseudoClass(QStyle::State state)-
1571{-
1572 quint64 pc = 0;-
1573 if (state & QStyle::State_Enabled) {-
1574 pc |= PseudoClass_Enabled;-
1575 if (state & QStyle::State_MouseOver)-
1576 pc |= PseudoClass_Hover;-
1577 } else {-
1578 pc |= PseudoClass_Disabled;-
1579 }-
1580 if (state & QStyle::State_Active)-
1581 pc |= PseudoClass_Active;-
1582 if (state & QStyle::State_Window)-
1583 pc |= PseudoClass_Window;-
1584 if (state & QStyle::State_Sunken)-
1585 pc |= PseudoClass_Pressed;-
1586 if (state & QStyle::State_HasFocus)-
1587 pc |= PseudoClass_Focus;-
1588 if (state & QStyle::State_On)-
1589 pc |= (PseudoClass_On | PseudoClass_Checked);-
1590 if (state & QStyle::State_Off)-
1591 pc |= (PseudoClass_Off | PseudoClass_Unchecked);-
1592 if (state & QStyle::State_NoChange)-
1593 pc |= PseudoClass_Indeterminate;-
1594 if (state & QStyle::State_Selected)-
1595 pc |= PseudoClass_Selected;-
1596 if (state & QStyle::State_Horizontal)-
1597 pc |= PseudoClass_Horizontal;-
1598 else-
1599 pc |= PseudoClass_Vertical;-
1600 if (state & (QStyle::State_Open | QStyle::State_On | QStyle::State_Sunken))-
1601 pc |= PseudoClass_Open;-
1602 else-
1603 pc |= PseudoClass_Closed;-
1604 if (state & QStyle::State_Children)-
1605 pc |= PseudoClass_Children;-
1606 if (state & QStyle::State_Sibling)-
1607 pc |= PseudoClass_Sibling;-
1608 if (state & QStyle::State_ReadOnly)-
1609 pc |= PseudoClass_ReadOnly;-
1610 if (state & QStyle::State_Item)-
1611 pc |= PseudoClass_Item;-
1612-
1613-
1614-
1615-
1616 return pc;-
1617}-
1618-
1619static void qt_check_if_internal_object(const QObject **obj, int *element)-
1620{-
1621-
1622-
1623-
1624-
1625 if (*obj && qstrcmp((*obj)->metaObject()->className(), "QDockWidgetTitleButton") == 0) {-
1626 if ((*obj)->objectName() == QLatin1String("qt_dockwidget_closebutton")) {-
1627 *element = PseudoElement_DockWidgetCloseButton;-
1628 } else if ((*obj)->objectName() == QLatin1String("qt_dockwidget_floatbutton")) {-
1629 *element = PseudoElement_DockWidgetFloatButton;-
1630 }-
1631 *obj = (*obj)->parent();-
1632 }-
1633-
1634}-
1635-
1636QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, int element, quint64 state) const-
1637{-
1638 qt_check_if_internal_object(&obj, &element);-
1639 QHash<quint64, QRenderRule> &cache = styleSheetCaches->renderRulesCache[obj][element];-
1640 QHash<quint64, QRenderRule>::const_iterator cacheIt = cache.constFind(state);-
1641 if (cacheIt != cache.constEnd())-
1642 return cacheIt.value();-
1643-
1644 if (!initObject(obj))-
1645 return QRenderRule();-
1646-
1647 quint64 stateMask = 0;-
1648 const QVector<StyleRule> rules = styleRules(obj);-
1649 for (int i = 0; i < rules.count(); i++) {-
1650 const Selector& selector = rules.at(i).selectors.at(0);-
1651 quint64 negated = 0;-
1652 stateMask |= selector.pseudoClass(&negated);-
1653 stateMask |= negated;-
1654 }-
1655-
1656 cacheIt = cache.constFind(state & stateMask);-
1657 if (cacheIt != cache.constEnd()) {-
1658 const QRenderRule &newRule = cacheIt.value();-
1659 cache[state] = newRule;-
1660 return newRule;-
1661 }-
1662-
1663-
1664 const QString part = QLatin1String(knownPseudoElements[element].name);-
1665 QVector<Declaration> decls = declarations(rules, part, state);-
1666 QRenderRule newRule(decls, obj);-
1667 cache[state] = newRule;-
1668 if ((state & stateMask) != state)-
1669 cache[state&stateMask] = newRule;-
1670 return newRule;-
1671}-
1672-
1673QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption *opt, int pseudoElement) const-
1674{-
1675 quint64 extraClass = 0;-
1676 QStyle::State state = opt ? opt->state : QStyle::State(QStyle::State_None);-
1677-
1678 if (const QStyleOptionComplex *complex = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {-
1679 if (pseudoElement != PseudoElement_None) {-
1680-
1681 QStyle::SubControl subControl = knownPseudoElements[pseudoElement].subControl;-
1682-
1683 if (!(complex->activeSubControls & subControl))-
1684 state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus);-
1685 }-
1686-
1687 switch (pseudoElement) {-
1688 case PseudoElement_ComboBoxDropDown:-
1689 case PseudoElement_ComboBoxArrow:-
1690 state |= (complex->state & (QStyle::State_On|QStyle::State_ReadOnly));-
1691 break;-
1692 case PseudoElement_SpinBoxUpButton:-
1693 case PseudoElement_SpinBoxDownButton:-
1694 case PseudoElement_SpinBoxUpArrow:-
1695 case PseudoElement_SpinBoxDownArrow:-
1696-
1697 if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {-
1698 bool on = false;-
1699 bool up = pseudoElement == PseudoElement_SpinBoxUpButton-
1700 || pseudoElement == PseudoElement_SpinBoxUpArrow;-
1701 if ((sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) && up)-
1702 on = true;-
1703 else if ((sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) && !up)-
1704 on = true;-
1705 state |= (on ? QStyle::State_On : QStyle::State_Off);-
1706 }-
1707-
1708 break;-
1709 case PseudoElement_GroupBoxTitle:-
1710 state |= (complex->state & (QStyle::State_MouseOver | QStyle::State_Sunken));-
1711 break;-
1712 case PseudoElement_ToolButtonMenu:-
1713 case PseudoElement_ToolButtonMenuArrow:-
1714 case PseudoElement_ToolButtonDownArrow:-
1715 state |= complex->state & QStyle::State_MouseOver;-
1716 if (complex->state & QStyle::State_Sunken ||-
1717 complex->activeSubControls & QStyle::SC_ToolButtonMenu)-
1718 state |= QStyle::State_Sunken;-
1719 break;-
1720 case PseudoElement_SliderGroove:-
1721 state |= complex->state & QStyle::State_MouseOver;-
1722 break;-
1723 default:-
1724 break;-
1725 }-
1726-
1727 if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {-
1728-
1729-
1730 if (pseudoElement == PseudoElement_None-
1731 && (complex->activeSubControls & QStyle::SC_ComboBoxEditField)-
1732 && (!(state & QStyle::State_MouseOver))) {-
1733 state |= QStyle::State_Sunken;-
1734 }-
1735-
1736 if (!combo->frame)-
1737 extraClass |= PseudoClass_Frameless;-
1738 if (!combo->editable)-
1739 extraClass |= PseudoClass_ReadOnly;-
1740 else-
1741 extraClass |= PseudoClass_Editable;-
1742-
1743 } else if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {-
1744 if (!spin->frame)-
1745 extraClass |= PseudoClass_Frameless;-
1746-
1747 } else if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {-
1748 if (gb->features & QStyleOptionFrame::Flat)-
1749 extraClass |= PseudoClass_Flat;-
1750 if (gb->lineWidth == 0)-
1751 extraClass |= PseudoClass_Frameless;-
1752 } else if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {-
1753 if (tb->titleBarState & Qt::WindowMinimized) {-
1754 extraClass |= PseudoClass_Minimized;-
1755 }-
1756 else if (tb->titleBarState & Qt::WindowMaximized)-
1757 extraClass |= PseudoClass_Maximized;-
1758 }-
1759 } else {-
1760-
1761 if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {-
1762 if (mi->menuItemType == QStyleOptionMenuItem::DefaultItem)-
1763 extraClass |= PseudoClass_Default;-
1764 if (mi->checkType == QStyleOptionMenuItem::Exclusive)-
1765 extraClass |= PseudoClass_Exclusive;-
1766 else if (mi->checkType == QStyleOptionMenuItem::NonExclusive)-
1767 extraClass |= PseudoClass_NonExclusive;-
1768 if (mi->checkType != QStyleOptionMenuItem::NotCheckable)-
1769 extraClass |= (mi->checked) ? (PseudoClass_On|PseudoClass_Checked)-
1770 : (PseudoClass_Off|PseudoClass_Unchecked);-
1771 } else if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {-
1772 if (hdr->position == QStyleOptionHeader::OnlyOneSection)-
1773 extraClass |= PseudoClass_OnlyOne;-
1774 else if (hdr->position == QStyleOptionHeader::Beginning)-
1775 extraClass |= PseudoClass_First;-
1776 else if (hdr->position == QStyleOptionHeader::End)-
1777 extraClass |= PseudoClass_Last;-
1778 else if (hdr->position == QStyleOptionHeader::Middle)-
1779 extraClass |= PseudoClass_Middle;-
1780-
1781 if (hdr->selectedPosition == QStyleOptionHeader::NextAndPreviousAreSelected)-
1782 extraClass |= (PseudoClass_NextSelected | PseudoClass_PreviousSelected);-
1783 else if (hdr->selectedPosition == QStyleOptionHeader::NextIsSelected)-
1784 extraClass |= PseudoClass_NextSelected;-
1785 else if (hdr->selectedPosition == QStyleOptionHeader::PreviousIsSelected)-
1786 extraClass |= PseudoClass_PreviousSelected;-
1787-
1788 } else if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {-
1789 switch (tab->shape) {-
1790 case QTabBar::RoundedNorth:-
1791 case QTabBar::TriangularNorth:-
1792 extraClass |= PseudoClass_Top;-
1793 break;-
1794 case QTabBar::RoundedSouth:-
1795 case QTabBar::TriangularSouth:-
1796 extraClass |= PseudoClass_Bottom;-
1797 break;-
1798 case QTabBar::RoundedEast:-
1799 case QTabBar::TriangularEast:-
1800 extraClass |= PseudoClass_Left;-
1801 break;-
1802 case QTabBar::RoundedWest:-
1803 case QTabBar::TriangularWest:-
1804 extraClass |= PseudoClass_Right;-
1805 break;-
1806 default:-
1807 break;-
1808 }-
1809-
1810-
1811 } else if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {-
1812 if (tab->position == QStyleOptionTab::OnlyOneTab)-
1813 extraClass |= PseudoClass_OnlyOne;-
1814 else if (tab->position == QStyleOptionTab::Beginning)-
1815 extraClass |= PseudoClass_First;-
1816 else if (tab->position == QStyleOptionTab::End)-
1817 extraClass |= PseudoClass_Last;-
1818 else if (tab->position == QStyleOptionTab::Middle)-
1819 extraClass |= PseudoClass_Middle;-
1820-
1821 if (tab->selectedPosition == QStyleOptionTab::NextIsSelected)-
1822 extraClass |= PseudoClass_NextSelected;-
1823 else if (tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)-
1824 extraClass |= PseudoClass_PreviousSelected;-
1825-
1826 switch (tab->shape) {-
1827 case QTabBar::RoundedNorth:-
1828 case QTabBar::TriangularNorth:-
1829 extraClass |= PseudoClass_Top;-
1830 break;-
1831 case QTabBar::RoundedSouth:-
1832 case QTabBar::TriangularSouth:-
1833 extraClass |= PseudoClass_Bottom;-
1834 break;-
1835 case QTabBar::RoundedEast:-
1836 case QTabBar::TriangularEast:-
1837 extraClass |= PseudoClass_Left;-
1838 break;-
1839 case QTabBar::RoundedWest:-
1840 case QTabBar::TriangularWest:-
1841 extraClass |= PseudoClass_Right;-
1842 break;-
1843 default:-
1844 break;-
1845 }-
1846-
1847 } else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {-
1848 if (btn->features & QStyleOptionButton::Flat)-
1849 extraClass |= PseudoClass_Flat;-
1850 if (btn->features & QStyleOptionButton::DefaultButton)-
1851 extraClass |= PseudoClass_Default;-
1852 } else if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {-
1853 if (frm->lineWidth == 0)-
1854 extraClass |= PseudoClass_Frameless;-
1855 if (frm->features & QStyleOptionFrame::Flat)-
1856 extraClass |= PseudoClass_Flat;-
1857 }-
1858-
1859 else if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {-
1860 if (tb->toolBarArea == Qt::LeftToolBarArea)-
1861 extraClass |= PseudoClass_Left;-
1862 else if (tb->toolBarArea == Qt::RightToolBarArea)-
1863 extraClass |= PseudoClass_Right;-
1864 else if (tb->toolBarArea == Qt::TopToolBarArea)-
1865 extraClass |= PseudoClass_Top;-
1866 else if (tb->toolBarArea == Qt::BottomToolBarArea)-
1867 extraClass |= PseudoClass_Bottom;-
1868-
1869 if (tb->positionWithinLine == QStyleOptionToolBar::Beginning)-
1870 extraClass |= PseudoClass_First;-
1871 else if (tb->positionWithinLine == QStyleOptionToolBar::Middle)-
1872 extraClass |= PseudoClass_Middle;-
1873 else if (tb->positionWithinLine == QStyleOptionToolBar::End)-
1874 extraClass |= PseudoClass_Last;-
1875 else if (tb->positionWithinLine == QStyleOptionToolBar::OnlyOne)-
1876 extraClass |= PseudoClass_OnlyOne;-
1877 }-
1878-
1879-
1880 else if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {-
1881 if (tb->position == QStyleOptionToolBox::OnlyOneTab)-
1882 extraClass |= PseudoClass_OnlyOne;-
1883 else if (tb->position == QStyleOptionToolBox::Beginning)-
1884 extraClass |= PseudoClass_First;-
1885 else if (tb->position == QStyleOptionToolBox::End)-
1886 extraClass |= PseudoClass_Last;-
1887 else if (tb->position == QStyleOptionToolBox::Middle)-
1888 extraClass |= PseudoClass_Middle;-
1889-
1890 if (tb->selectedPosition == QStyleOptionToolBox::NextIsSelected)-
1891 extraClass |= PseudoClass_NextSelected;-
1892 else if (tb->selectedPosition == QStyleOptionToolBox::PreviousIsSelected)-
1893 extraClass |= PseudoClass_PreviousSelected;-
1894 }-
1895-
1896-
1897 else if (const QStyleOptionDockWidget *dw = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {-
1898 if (dw->verticalTitleBar)-
1899 extraClass |= PseudoClass_Vertical;-
1900 else-
1901 extraClass |= PseudoClass_Horizontal;-
1902 if (dw->closable)-
1903 extraClass |= PseudoClass_Closable;-
1904 if (dw->floatable)-
1905 extraClass |= PseudoClass_Floatable;-
1906 if (dw->movable)-
1907 extraClass |= PseudoClass_Movable;-
1908 }-
1909-
1910-
1911 else if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {-
1912 if (vopt->features & QStyleOptionViewItem::Alternate)-
1913 extraClass |= PseudoClass_Alternate;-
1914 if (vopt->viewItemPosition == QStyleOptionViewItem::OnlyOne)-
1915 extraClass |= PseudoClass_OnlyOne;-
1916 else if (vopt->viewItemPosition == QStyleOptionViewItem::Beginning)-
1917 extraClass |= PseudoClass_First;-
1918 else if (vopt->viewItemPosition == QStyleOptionViewItem::End)-
1919 extraClass |= PseudoClass_Last;-
1920 else if (vopt->viewItemPosition == QStyleOptionViewItem::Middle)-
1921 extraClass |= PseudoClass_Middle;-
1922-
1923 }-
1924-
1925-
1926-
1927 if (const QLineEdit *lineEdit = qobject_cast<const QLineEdit *>(obj)) {-
1928 state &= ~QStyle::State_Sunken;-
1929 if (lineEdit->hasFrame()) {-
1930 extraClass &= ~PseudoClass_Frameless;-
1931 } else {-
1932 extraClass |= PseudoClass_Frameless;-
1933 }-
1934 } else-
1935-
1936 if (const QFrame *frm = qobject_cast<const QFrame *>(obj)) {-
1937 if (frm->lineWidth() == 0)-
1938 extraClass |= PseudoClass_Frameless;-
1939 }-
1940 }-
1941-
1942 return renderRule(obj, pseudoElement, pseudoClass(state) | extraClass);-
1943}-
1944-
1945bool QStyleSheetStyle::hasStyleRule(const QObject *obj, int part) const-
1946{-
1947 QHash<int, bool> &cache = styleSheetCaches->hasStyleRuleCache[obj];-
1948 QHash<int, bool>::const_iterator cacheIt = cache.constFind(part);-
1949 if (cacheIt != cache.constEnd())-
1950 return cacheIt.value();-
1951-
1952 if (!initObject(obj))-
1953 return false;-
1954-
1955-
1956 const QVector<StyleRule> &rules = styleRules(obj);-
1957 if (part == PseudoElement_None) {-
1958 bool result = obj && !rules.isEmpty();-
1959 cache[part] = result;-
1960 return result;-
1961 }-
1962-
1963 QString pseudoElement = QLatin1String(knownPseudoElements[part].name);-
1964 for (int i = 0; i < rules.count(); i++) {-
1965 const Selector& selector = rules.at(i).selectors.at(0);-
1966 if (pseudoElement.compare(selector.pseudoElement(), Qt::CaseInsensitive) == 0) {-
1967 cache[part] = true;-
1968 return true;-
1969 }-
1970 }-
1971-
1972 cache[part] = false;-
1973 return false;-
1974}-
1975-
1976static Origin defaultOrigin(int pe)-
1977{-
1978 switch (pe) {-
1979 case PseudoElement_ScrollBarAddPage:-
1980 case PseudoElement_ScrollBarSubPage:-
1981 case PseudoElement_ScrollBarAddLine:-
1982 case PseudoElement_ScrollBarSubLine:-
1983 case PseudoElement_ScrollBarFirst:-
1984 case PseudoElement_ScrollBarLast:-
1985 case PseudoElement_GroupBoxTitle:-
1986 case PseudoElement_GroupBoxIndicator:-
1987 case PseudoElement_ToolButtonMenu:-
1988 case PseudoElement_SliderAddPage:-
1989 case PseudoElement_SliderSubPage:-
1990 return Origin_Border;-
1991-
1992 case PseudoElement_SpinBoxUpButton:-
1993 case PseudoElement_SpinBoxDownButton:-
1994 case PseudoElement_PushButtonMenuIndicator:-
1995 case PseudoElement_ComboBoxDropDown:-
1996 case PseudoElement_ToolButtonDownArrow:-
1997 case PseudoElement_MenuCheckMark:-
1998 case PseudoElement_MenuIcon:-
1999 case PseudoElement_MenuRightArrow:-
2000 return Origin_Padding;-
2001-
2002 case PseudoElement_Indicator:-
2003 case PseudoElement_ExclusiveIndicator:-
2004 case PseudoElement_ComboBoxArrow:-
2005 case PseudoElement_ScrollBarSlider:-
2006 case PseudoElement_ScrollBarUpArrow:-
2007 case PseudoElement_ScrollBarDownArrow:-
2008 case PseudoElement_ScrollBarLeftArrow:-
2009 case PseudoElement_ScrollBarRightArrow:-
2010 case PseudoElement_SpinBoxUpArrow:-
2011 case PseudoElement_SpinBoxDownArrow:-
2012 case PseudoElement_ToolButtonMenuArrow:-
2013 case PseudoElement_HeaderViewUpArrow:-
2014 case PseudoElement_HeaderViewDownArrow:-
2015 case PseudoElement_SliderGroove:-
2016 case PseudoElement_SliderHandle:-
2017 return Origin_Content;-
2018-
2019 default:-
2020 return Origin_Margin;-
2021 }-
2022}-
2023-
2024static Qt::Alignment defaultPosition(int pe)-
2025{-
2026 switch (pe) {-
2027 case PseudoElement_Indicator:-
2028 case PseudoElement_ExclusiveIndicator:-
2029 case PseudoElement_MenuCheckMark:-
2030 case PseudoElement_MenuIcon:-
2031 return Qt::AlignLeft | Qt::AlignVCenter;-
2032-
2033 case PseudoElement_ScrollBarAddLine:-
2034 case PseudoElement_ScrollBarLast:-
2035 case PseudoElement_SpinBoxDownButton:-
2036 case PseudoElement_PushButtonMenuIndicator:-
2037 case PseudoElement_ToolButtonDownArrow:-
2038 return Qt::AlignRight | Qt::AlignBottom;-
2039-
2040 case PseudoElement_ScrollBarSubLine:-
2041 case PseudoElement_ScrollBarFirst:-
2042 case PseudoElement_SpinBoxUpButton:-
2043 case PseudoElement_ComboBoxDropDown:-
2044 case PseudoElement_ToolButtonMenu:-
2045 case PseudoElement_DockWidgetCloseButton:-
2046 case PseudoElement_DockWidgetFloatButton:-
2047 return Qt::AlignRight | Qt::AlignTop;-
2048-
2049 case PseudoElement_ScrollBarUpArrow:-
2050 case PseudoElement_ScrollBarDownArrow:-
2051 case PseudoElement_ScrollBarLeftArrow:-
2052 case PseudoElement_ScrollBarRightArrow:-
2053 case PseudoElement_SpinBoxUpArrow:-
2054 case PseudoElement_SpinBoxDownArrow:-
2055 case PseudoElement_ComboBoxArrow:-
2056 case PseudoElement_DownArrow:-
2057 case PseudoElement_ToolButtonMenuArrow:-
2058 case PseudoElement_SliderGroove:-
2059 return Qt::AlignCenter;-
2060-
2061 case PseudoElement_GroupBoxTitle:-
2062 case PseudoElement_GroupBoxIndicator:-
2063 return Qt::AlignLeft | Qt::AlignTop;-
2064-
2065 case PseudoElement_HeaderViewUpArrow:-
2066 case PseudoElement_HeaderViewDownArrow:-
2067 case PseudoElement_MenuRightArrow:-
2068 return Qt::AlignRight | Qt::AlignVCenter;-
2069-
2070 default:-
2071 return 0;-
2072 }-
2073}-
2074-
2075QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rect, int pe) const-
2076{-
2077 QStyle *base = baseStyle();-
2078-
2079 switch (pe) {-
2080 case PseudoElement_Indicator:-
2081 case PseudoElement_MenuCheckMark:-
2082 if (sz.width() == -1)-
2083 sz.setWidth(base->pixelMetric(PM_IndicatorWidth, 0, w));-
2084 if (sz.height() == -1)-
2085 sz.setHeight(base->pixelMetric(PM_IndicatorHeight, 0, w));-
2086 break;-
2087-
2088 case PseudoElement_ExclusiveIndicator:-
2089 case PseudoElement_GroupBoxIndicator:-
2090 if (sz.width() == -1)-
2091 sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, 0, w));-
2092 if (sz.height() == -1)-
2093 sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, 0, w));-
2094 break;-
2095-
2096 case PseudoElement_PushButtonMenuIndicator: {-
2097 int pm = base->pixelMetric(PM_MenuButtonIndicator, 0, w);-
2098 if (sz.width() == -1)-
2099 sz.setWidth(pm);-
2100 if (sz.height() == -1)-
2101 sz.setHeight(pm);-
2102 }-
2103 break;-
2104-
2105 case PseudoElement_ComboBoxDropDown:-
2106 if (sz.width() == -1)-
2107 sz.setWidth(16);-
2108 break;-
2109-
2110 case PseudoElement_ComboBoxArrow:-
2111 case PseudoElement_DownArrow:-
2112 case PseudoElement_ToolButtonMenuArrow:-
2113 case PseudoElement_ToolButtonDownArrow:-
2114 case PseudoElement_MenuRightArrow:-
2115 if (sz.width() == -1)-
2116 sz.setWidth(13);-
2117 if (sz.height() == -1)-
2118 sz.setHeight(13);-
2119 break;-
2120-
2121 case PseudoElement_SpinBoxUpButton:-
2122 case PseudoElement_SpinBoxDownButton:-
2123 if (sz.width() == -1)-
2124 sz.setWidth(16);-
2125 if (sz.height() == -1)-
2126 sz.setHeight(rect.height()/2);-
2127 break;-
2128-
2129 case PseudoElement_ToolButtonMenu:-
2130 if (sz.width() == -1)-
2131 sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, 0, w));-
2132 break;-
2133-
2134 case PseudoElement_HeaderViewUpArrow:-
2135 case PseudoElement_HeaderViewDownArrow: {-
2136 int pm = base->pixelMetric(PM_HeaderMargin, 0, w);-
2137 if (sz.width() == -1)-
2138 sz.setWidth(pm);-
2139 if (sz.height() == 1)-
2140 sz.setHeight(pm);-
2141 break;-
2142 }-
2143-
2144 case PseudoElement_ScrollBarFirst:-
2145 case PseudoElement_ScrollBarLast:-
2146 case PseudoElement_ScrollBarAddLine:-
2147 case PseudoElement_ScrollBarSubLine:-
2148 case PseudoElement_ScrollBarSlider: {-
2149 int pm = pixelMetric(QStyle::PM_ScrollBarExtent, 0, w);-
2150 if (sz.width() == -1)-
2151 sz.setWidth(pm);-
2152 if (sz.height() == -1)-
2153 sz.setHeight(pm);-
2154 break;-
2155 }-
2156-
2157 case PseudoElement_DockWidgetCloseButton:-
2158 case PseudoElement_DockWidgetFloatButton: {-
2159 int iconSize = pixelMetric(PM_SmallIconSize, 0, w);-
2160 return QSize(iconSize, iconSize);-
2161 }-
2162-
2163 default:-
2164 break;-
2165 }-
2166-
2167-
2168 if (sz.height() == -1)-
2169 sz.setHeight(rect.height());-
2170 if (sz.width() == -1)-
2171 sz.setWidth(rect.width());-
2172-
2173 return sz;-
2174}-
2175-
2176static PositionMode defaultPositionMode(int pe)-
2177{-
2178 switch (pe) {-
2179 case PseudoElement_ScrollBarFirst:-
2180 case PseudoElement_ScrollBarLast:-
2181 case PseudoElement_ScrollBarAddLine:-
2182 case PseudoElement_ScrollBarSubLine:-
2183 case PseudoElement_ScrollBarAddPage:-
2184 case PseudoElement_ScrollBarSubPage:-
2185 case PseudoElement_ScrollBarSlider:-
2186 case PseudoElement_SliderGroove:-
2187 case PseudoElement_SliderHandle:-
2188 case PseudoElement_TabWidgetPane:-
2189 return PositionMode_Absolute;-
2190 default:-
2191 return PositionMode_Static;-
2192 }-
2193}-
2194-
2195QRect QStyleSheetStyle::positionRect(const QWidget *w, const QRenderRule &rule2, int pe,-
2196 const QRect &originRect, Qt::LayoutDirection dir) const-
2197{-
2198 const QStyleSheetPositionData *p = rule2.position();-
2199 PositionMode mode = (p && p->mode != PositionMode_Unknown) ? p->mode : defaultPositionMode(pe);-
2200 Qt::Alignment position = (p && p->position != 0) ? p->position : defaultPosition(pe);-
2201 QRect r;-
2202-
2203 if (mode != PositionMode_Absolute) {-
2204 QSize sz = defaultSize(w, rule2.size(), originRect, pe);-
2205 sz = sz.expandedTo(rule2.minimumContentsSize());-
2206 r = QStyle::alignedRect(dir, position, sz, originRect);-
2207 if (p) {-
2208 int left = p->left ? p->left : -p->right;-
2209 int top = p->top ? p->top : -p->bottom;-
2210 r.translate(dir == Qt::LeftToRight ? left : -left, top);-
2211 }-
2212 } else {-
2213 r = p ? originRect.adjusted(dir == Qt::LeftToRight ? p->left : p->right, p->top,-
2214 dir == Qt::LeftToRight ? -p->right : -p->left, -p->bottom)-
2215 : originRect;-
2216 if (rule2.hasContentsSize()) {-
2217 QSize sz = rule2.size().expandedTo(rule2.minimumContentsSize());-
2218 if (sz.width() == -1) sz.setWidth(r.width());-
2219 if (sz.height() == -1) sz.setHeight(r.height());-
2220 r = QStyle::alignedRect(dir, position, sz, r);-
2221 }-
2222 }-
2223 return r;-
2224}-
2225-
2226QRect QStyleSheetStyle::positionRect(const QWidget *w, const QRenderRule& rule1, const QRenderRule& rule2, int pe,-
2227 const QRect& rect, Qt::LayoutDirection dir) const-
2228{-
2229 const QStyleSheetPositionData *p = rule2.position();-
2230 Origin origin = (p && p->origin != Origin_Unknown) ? p->origin : defaultOrigin(pe);-
2231 QRect originRect = rule1.originRect(rect, origin);-
2232 return positionRect(w, rule2, pe, originRect, dir);-
2233}-
2234-
2235-
2236-
2237-
2238-
2239-
2240static QWidget *embeddedWidget(QWidget *w)-
2241{-
2242-
2243 if (QComboBox *cmb = qobject_cast<QComboBox *>(w)) {-
2244 if (cmb->isEditable())-
2245 return cmb->lineEdit();-
2246 else-
2247 return cmb;-
2248 }-
2249-
2250-
2251-
2252 if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w))-
2253 return sb->findChild<QLineEdit *>();-
2254-
2255-
2256-
2257 if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w))-
2258 return sa->viewport();-
2259-
2260-
2261 return w;-
2262}-
2263static QWidget *containerWidget(const QWidget *w)-
2264{-
2265-
2266 if (qobject_cast<const QLineEdit *>(w)) {-
2267-
2268-
2269 if (qobject_cast<const QComboBox *>(w->parentWidget()))-
2270 return w->parentWidget();-
2271-
2272-
2273 if (qobject_cast<const QAbstractSpinBox *>(w->parentWidget()))-
2274 return w->parentWidget();-
2275-
2276 }-
2277-
2278-
2279-
2280 if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) {-
2281 if (sa->viewport() == w)-
2282 return w->parentWidget();-
2283 }-
2284-
2285-
2286 return const_cast<QWidget *>(w);-
2287}-
2288-
2289-
2290-
2291-
2292static bool unstylable(const QWidget *w)-
2293{-
2294 if (w->windowType() == Qt::Desktop)-
2295 return true;-
2296-
2297 if (!w->styleSheet().isEmpty())-
2298 return false;-
2299-
2300 if (containerWidget(w) != w)-
2301 return true;-
2302-
2303-
2304-
2305 else if (qobject_cast<const QFrame *>(w)) {-
2306 if (0-
2307-
2308 || qobject_cast<const QComboBox *>(w->parentWidget())-
2309-
2310 )-
2311 return true;-
2312 }-
2313-
2314-
2315-
2316 if (w->metaObject() == &QWidget::staticMetaObject-
2317 && qobject_cast<const QTabBar*>(w->parentWidget()))-
2318 return true;-
2319-
2320-
2321 return false;-
2322}-
2323-
2324static quint64 extendedPseudoClass(const QWidget *w)-
2325{-
2326 quint64 pc = w->isWindow() ? quint64(PseudoClass_Window) : 0;-
2327 if (const QAbstractSlider *slider = qobject_cast<const QAbstractSlider *>(w)) {-
2328 pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal);-
2329 } else-
2330-
2331 if (const QComboBox *combo = qobject_cast<const QComboBox *>(w)) {-
2332 if (combo->isEditable())-
2333 pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly);-
2334 } else-
2335-
2336-
2337 if (const QLineEdit *edit = qobject_cast<const QLineEdit *>(w)) {-
2338 pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable);-
2339 } else-
2340-
2341 { }-
2342 return pc;-
2343}-
2344-
2345-
2346-
2347-
2348-
2349-
2350-
2351void QStyleSheetStyle::setGeometry(QWidget *w)-
2352{-
2353 QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Enabled | extendedPseudoClass(w));-
2354 const QStyleSheetGeometryData *geo = rule.geometry();-
2355 if (w->property("_q_stylesheet_minw").toBool()-
2356 && ((!rule.hasGeometry() || geo->minWidth == -1))) {-
2357 w->setMinimumWidth(0);-
2358 w->setProperty("_q_stylesheet_minw", QVariant());-
2359 }-
2360 if (w->property("_q_stylesheet_minh").toBool()-
2361 && ((!rule.hasGeometry() || geo->minHeight == -1))) {-
2362 w->setMinimumHeight(0);-
2363 w->setProperty("_q_stylesheet_minh", QVariant());-
2364 }-
2365 if (w->property("_q_stylesheet_maxw").toBool()-
2366 && ((!rule.hasGeometry() || geo->maxWidth == -1))) {-
2367 w->setMaximumWidth(((1<<24)-1));-
2368 w->setProperty("_q_stylesheet_maxw", QVariant());-
2369 }-
2370 if (w->property("_q_stylesheet_maxh").toBool()-
2371 && ((!rule.hasGeometry() || geo->maxHeight == -1))) {-
2372 w->setMaximumHeight(((1<<24)-1));-
2373 w->setProperty("_q_stylesheet_maxh", QVariant());-
2374 }-
2375-
2376-
2377 if (rule.hasGeometry()) {-
2378 if (geo->minWidth != -1) {-
2379 w->setProperty("_q_stylesheet_minw", true);-
2380 w->setMinimumWidth(rule.boxSize(QSize(qMax(geo->width, geo->minWidth), 0)).width());-
2381 }-
2382 if (geo->minHeight != -1) {-
2383 w->setProperty("_q_stylesheet_minh", true);-
2384 w->setMinimumHeight(rule.boxSize(QSize(0, qMax(geo->height, geo->minHeight))).height());-
2385 }-
2386 if (geo->maxWidth != -1) {-
2387 w->setProperty("_q_stylesheet_maxw", true);-
2388 w->setMaximumWidth(rule.boxSize(QSize(qMin(geo->width == -1 ? ((1<<24)-1) : geo->width,-
2389 geo->maxWidth == -1 ? ((1<<24)-1) : geo->maxWidth), 0)).width());-
2390 }-
2391 if (geo->maxHeight != -1) {-
2392 w->setProperty("_q_stylesheet_maxh", true);-
2393 w->setMaximumHeight(rule.boxSize(QSize(0, qMin(geo->height == -1 ? ((1<<24)-1) : geo->height,-
2394 geo->maxHeight == -1 ? ((1<<24)-1) : geo->maxHeight))).height());-
2395 }-
2396 }-
2397}-
2398-
2399void QStyleSheetStyle::setProperties(QWidget *w)-
2400{-
2401-
2402-
2403-
2404-
2405 const QVector<Declaration> decls = declarations(styleRules(w), QString());-
2406 QVector<int> finals;-
2407-
2408 {-
2409-
2410 QSet<const QString> propertySet;-
2411 for (int i = decls.count() - 1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
2412 const QString property = decls.at(i).d->property;-
2413 if (!property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive)
!property.star...seInsensitive)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2414 continue;
never executed: continue;
0
2415 if (!propertySet.contains(property)
!propertySet.c...ains(property)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2416 propertySet.insert(property);-
2417 finals.append(i);-
2418 }
never executed: end of block
0
2419 }
never executed: end of block
0
2420 }-
2421-
2422 for (int i = finals.count() - 1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
2423 const Declaration &decl = decls.at(finals[i]);-
2424 QString property = decl.d->property;-
2425 property.remove(0, 10);-
2426-
2427 const QMetaObject *metaObject = w->metaObject();-
2428 int index = metaObject->indexOfProperty(property.toLatin1());-
2429 if (__builtin_expect(!!(
__builtin_expe...== -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
index == -1)), false)
__builtin_expe...== -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2430 QMessageLogger(__FILE__, 25212527, __PRETTY_FUNCTION__).warning() << w << " does not have a property named " << property;-
2431 continue;
never executed: continue;
0
2432 }-
2433 const QMetaProperty metaProperty = metaObject->property(index);-
2434 if (!(__builtin_expect(!!(!
__builtin_expe...ble()), false)Description
TRUEnever evaluated
FALSEnever evaluated
metaProperty.isWritable() || !metaProperty.isDesignable())()), false)
__builtin_expe...ble()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2435 QMessageLogger(__FILE__, 25262532, __PRETTY_FUNCTION__).warning() << w << " cannot design property named " << property;-
2436 continue;
never executed: continue;
0
2437 }-
2438-
2439 QVariant v;-
2440 const QVariant value = w->property(property.toLatin1());-
2441 switch (value.type()) {-
2442 case
never executed: case QVariant::Icon:
QVariant::Icon:
never executed: case QVariant::Icon:
v = decl.iconValue(); break;
never executed: break;
0
2443 case
never executed: case QVariant::Image:
QVariant::Image:
never executed: case QVariant::Image:
v = QImage(decl.uriValue()); break;
never executed: break;
0
2444 case
never executed: case QVariant::Pixmap:
QVariant::Pixmap:
never executed: case QVariant::Pixmap:
v = QPixmap(decl.uriValue()); break;
never executed: break;
0
2445 case
never executed: case QVariant::Rect:
QVariant::Rect:
never executed: case QVariant::Rect:
v = decl.rectValue(); break;
never executed: break;
0
2446 case
never executed: case QVariant::Size:
QVariant::Size:
never executed: case QVariant::Size:
v = decl.sizeValue(); break;
never executed: break;
0
2447 case
never executed: case QVariant::Color:
QVariant::Color:
never executed: case QVariant::Color:
v = decl.colorValue(); break;
never executed: break;
0
2448 case
never executed: case QVariant::Brush:
QVariant::Brush:
never executed: case QVariant::Brush:
v = decl.brushValue(); break;
never executed: break;
0
2449-
2450 case
never executed: case QVariant::KeySequence:
QVariant::KeySequence:
never executed: case QVariant::KeySequence:
v = QKeySequence(decl.d->values.at(0).variant.toString()); break;
never executed: break;
0
2451-
2452 default
never executed: default:
:
never executed: default:
v = decl.d->values.at(0).variant; break;
never executed: break;
0
2453 }-
2454-
2455 w->setProperty(property.toLatin1(), v);-
2456 }
never executed: end of block
0
2457}
never executed: end of block
0
2458-
2459void QStyleSheetStyle::setPalette(QWidget *w)-
2460{-
2461 struct RuleRoleMap {-
2462 int state;-
2463 QPalette::ColorGroup group;-
2464 } map[3] = {-
2465 { int(PseudoClass_Active | PseudoClass_Enabled), QPalette::Active },-
2466 { PseudoClass_Disabled, QPalette::Disabled },-
2467 { PseudoClass_Enabled, QPalette::Inactive }-
2468 };-
2469-
2470 const bool useStyleSheetPropagationInWidgetStyles =-
2471 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
2472-
2473 QPalette p;-
2474 if (!useStyleSheetPropagationInWidgetStyles
!useStyleSheet...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2475 p = w->palette();
never executed: p = w->palette();
0
2476-
2477 QWidget *ew = embeddedWidget(w);-
2478-
2479 for (int i = 0; i < 3
i < 3Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
2480 QRenderRule rule = renderRule(w, PseudoElement_None, map[i].state | extendedPseudoClass(w));-
2481 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2482 if (!w->property("_q_styleSheetWidgetFont").isValid()
!w->property("...nt").isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2483 saveWidgetFont(w, w->font());-
2484 }
never executed: end of block
0
2485 updateStyleSheetFont(w);-
2486 if (ew != w
ew != wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2487 updateStyleSheetFont(ew);
never executed: updateStyleSheetFont(ew);
0
2488 }
never executed: end of block
0
2489-
2490 rule.configurePalette(&p, map[i].group, ew, ew != w);-
2491 }
never executed: end of block
0
2492-
2493 if (!useStyleSheetPropagationInWidgetStyles
!useStyleSheet...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
|| p.resolve() != 0
p.resolve() != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2494 QPalette wp = w->palette();-
2495 styleSheetCaches->customPaletteWidgets.insert(w, w->paletteqMakePair(wp, p.resolve()));-
2496-
2497 if (useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2498 p = p.resolve(wp);-
2499 p.resolve(p.resolve() | wp.resolve());-
2500 }
never executed: end of block
0
2501-
2502 w->setPalette(p);-
2503 if (ew != w
ew != wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2504 ew->setPalette(p);
never executed: ew->setPalette(p);
0
2505 }
never executed: end of block
0
2506}
never executed: end of block
0
2507-
2508void QStyleSheetStyle::unsetPalette(QWidget *w)-
2509{-
2510 const bool useStyleSheetPropagationInWidgetStyles =-
2511 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
2512-
2513 if (styleSheetCaches->customPaletteWidgets.contains(w)
styleSheetCach...ts.contains(w)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2514 QPair<QPalette, uint> p = styleSheetCaches->customPaletteWidgets.value(w);-
2515 styleSheetCaches->customPaletteWidgets.remove(w);-
2516-
2517 QPalette original = p.first;-
2518-
2519 if (useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2520 original.resolve(original.resolve() & p.second);-
2521-
2522 QPalette wp = w->setPalettepalette();-
2523 wp.resolve(wp.resolve() & ~p.second);-
2524 wp.resolve(original);-
2525 wp.resolve(wp.resolve() | original.resolve());-
2526 original = wp;-
2527 }
never executed: end of block
0
2528-
2529 w->setPalette(original);-
2530 QWidget *ew = embeddedWidget(w);-
2531 if (ew != w
ew != wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2532 ew->setPalette(poriginal);
never executed: ew->setPalette(original);
0
2533 styleSheetCaches->customPaletteWidgets.remove}
never executed: end of block
0
2534-
2535 if (useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2536 unsetStyleSheetFont(w);-
2537 QWidget *ew = embeddedWidget(w);-
2538 if (ew !=
ew != wDescription
TRUEnever evaluated
FALSEnever evaluated
w
ew != wDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2539 unsetStyleSheetFont(ew
never executed: unsetStyleSheetFont(ew);
never executed: unsetStyleSheetFont(ew);
);
never executed: unsetStyleSheetFont(ew);
0
2540 }
never executed: end of block
else {
0
2541 QVariant oldFont = w->property("_q_styleSheetWidgetFont");-
2542 if (oldFont.isValid()
oldFont.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2543 w->setFont(qvariant_cast<QFont>(oldFont));-
2544 }
never executed: end of block
0
2545 }
never executed: end of block
0
2546-
2547 if (styleSheetCaches->autoFillDisabledWidgets.contains(w)
styleSheetCach...ts.contains(w)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2548 embeddedWidget(w)->setAutoFillBackground(true);-
2549 styleSheetCaches->autoFillDisabledWidgets.remove(w);-
2550 }
never executed: end of block
0
2551}
never executed: end of block
0
2552-
2553void QStyleSheetStyle::unsetStyleSheetFont(QWidget *w) const-
2554{-
2555 if (styleSheetCaches->customFontWidgets.contains(w)
styleSheetCach...ts.contains(w)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2556 QPair<QFont, uint> f = styleSheetCaches->customFontWidgets.value(w);-
2557 styleSheetCaches->customFontWidgets.remove(w);-
2558-
2559 QFont original = f.first;-
2560 original.resolve(original.resolve() & f.second);-
2561-
2562 QFont font = w->font();-
2563 font.resolve(font.resolve() & ~f.second);-
2564 font.resolve(original);-
2565 font.resolve(font.resolve() | original.resolve());-
2566-
2567 w->setFont(font);-
2568 }
never executed: end of block
0
2569}
never executed: end of block
0
2570-
2571static void updateObjects(const QList<const QObject *>& objects)-
2572{-
2573 if (!styleSheetCaches->styleRulesCache.isEmpty() || !styleSheetCaches->hasStyleRuleCache.isEmpty() || !styleSheetCaches->renderRulesCache.isEmpty()) {-
2574 for (int i = 0; i < objects.size(); ++i) {-
2575 const QObject *object = objects.at(i);-
2576 styleSheetCaches->styleRulesCache.remove(object);-
2577 styleSheetCaches->hasStyleRuleCache.remove(object);-
2578 styleSheetCaches->renderRulesCache.remove(object);-
2579 }-
2580 }-
2581-
2582 QWidgetList widgets;-
2583 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(objects)>::type> _container_((objects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QObject *object = *_container_.i; _container_.control; _container_.control = 0) {-
2584 if (QWidget *w = qobject_cast<QWidget*>(const_cast<QObject*>(object)))-
2585 widgets << w;-
2586 }-
2587-
2588 QEvent event(QEvent::StyleChange);-
2589 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(widgets)>::type> _container_((widgets)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QWidget *widget = *_container_.i; _container_.control; _container_.control = 0) {-
2590 widget->style()->polish(widget);-
2591 QApplication::sendEvent(widget, &event);-
2592 }-
2593}-
2594-
2595-
2596-
2597int QStyleSheetStyle::numinstances = 0;-
2598-
2599QStyleSheetStyle::QStyleSheetStyle(QStyle *base)-
2600 : QWindowsStyle(*new QStyleSheetStylePrivate), base(base), refcount(1)-
2601{-
2602 ++numinstances;-
2603 if (numinstances == 1) {-
2604 styleSheetCaches = new QStyleSheetStyleCaches;-
2605 }-
2606}-
2607-
2608QStyleSheetStyle::~QStyleSheetStyle()-
2609{-
2610 --numinstances;-
2611 if (numinstances == 0) {-
2612 delete styleSheetCaches;-
2613 }-
2614}-
2615QStyle *QStyleSheetStyle::baseStyle() const-
2616{-
2617 if (base)-
2618 return base;-
2619 if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(QApplication::style()))-
2620 return me->base;-
2621 return QApplication::style();-
2622}-
2623-
2624void QStyleSheetStyleCaches::objectDestroyed(QObject *o)-
2625{-
2626 styleRulesCache.remove(o);-
2627 hasStyleRuleCache.remove(o);-
2628 renderRulesCache.remove(o);-
2629 customPaletteWidgets.remove((const QWidget *)o);-
2630 customFontWidgets.remove(static_cast<QWidget *>(o));-
2631 styleSheetCache.remove(o);-
2632 autoFillDisabledWidgets.remove((const QWidget *)o);-
2633}
never executed: end of block
0
2634-
2635void QStyleSheetStyleCaches::styleDestroyed(QObject *o)-
2636{-
2637 styleSheetCache.remove(o);-
2638}-
2639-
2640-
2641-
2642-
2643-
2644bool QStyleSheetStyle::initObject(const QObject *obj) const-
2645{-
2646 if (!obj)-
2647 return false;-
2648 if (const QWidget *w = qobject_cast<const QWidget*>(obj)) {-
2649 if (w->testAttribute(Qt::WA_StyleSheet))-
2650 return true;-
2651 if (unstylable(w))-
2652 return false;-
2653 const_cast<QWidget *>(w)->setAttribute(Qt::WA_StyleSheet, true);-
2654 }-
2655-
2656 QObject::connect(obj, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "2688""2753"), styleSheetCaches, qFlagLocation("1""objectDestroyed(QObject*)" "\0" __FILE__ ":" "2688""2753"), Qt::UniqueConnection);-
2657 return true;-
2658}-
2659-
2660void QStyleSheetStyle::polish(QWidget *w)-
2661{-
2662 baseStyle()->polish(w);-
2663 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return; } QStyleSheetStyleRecursionGuard recursion_guard(this);-
2664-
2665 if (!initObject(w))-
2666 return;-
2667-
2668 if (styleSheetCaches->styleRulesCache.contains(w)) {-
2669-
2670-
2671 styleSheetCaches->styleRulesCache.remove(w);-
2672 styleSheetCaches->hasStyleRuleCache.remove(w);-
2673 styleSheetCaches->renderRulesCache.remove(w);-
2674 styleSheetCaches->styleSheetCache.remove(w);-
2675 }-
2676 setGeometry(w);-
2677 setProperties(w);-
2678 unsetPalette(w);-
2679 setPalette(w);-
2680-
2681-
2682 QVector<StyleRule> rules = styleRules(w);-
2683 for (int i = 0; i < rules.count(); i++) {-
2684 const Selector& selector = rules.at(i).selectors.at(0);-
2685 quint64 negated = 0;-
2686 quint64 cssClass = selector.pseudoClass(&negated);-
2687 if ( cssClass & PseudoClass_Hover || negated & PseudoClass_Hover) {-
2688 w->setAttribute(Qt::WA_Hover);-
2689 embeddedWidget(w)->setAttribute(Qt::WA_Hover);-
2690 }-
2691 }-
2692-
2693-
2694-
2695 if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {-
2696 QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled);-
2697 if ((rule.hasBorder() && rule.border()->hasBorderImage())-
2698 || (rule.hasBackground() && !rule.background()->pixmap.isNull())) {-
2699 QObject::connect(sa->horizontalScrollBar(), qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "2731""2796"),-
2700 sa, qFlagLocation("1""update()" "\0" __FILE__ ":" "2732""2797"), Qt::UniqueConnection);-
2701 QObject::connect(sa->verticalScrollBar(), qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "2733""2798"),-
2702 sa, qFlagLocation("1""update()" "\0" __FILE__ ":" "2734""2799"), Qt::UniqueConnection);-
2703 }-
2704 }-
2705-
2706-
2707 QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Any);-
2708 if (rule.hasDrawable() || rule.hasBox()) {-
2709 if (w->metaObject() == &QWidget::staticMetaObject-
2710-
2711 || qobject_cast<QHeaderView *>(w)-
2712-
2713-
2714 || qobject_cast<QTabBar *>(w)-
2715-
2716-
2717 || qobject_cast<QFrame *>(w)-
2718-
2719-
2720 || qobject_cast<QMainWindow *>(w)-
2721-
2722-
2723 || qobject_cast<QMdiSubWindow *>(w)-
2724-
2725-
2726 || qobject_cast<QMenuBar *>(w)-
2727-
2728 || qobject_cast<QDialog *>(w)) {-
2729 w->setAttribute(Qt::WA_StyledBackground, true);-
2730 }-
2731 QWidget *ew = embeddedWidget(w);-
2732 if (ew->autoFillBackground()) {-
2733 ew->setAutoFillBackground(false);-
2734 styleSheetCaches->autoFillDisabledWidgets.insert(w);-
2735 if (ew != w) {-
2736-
2737 ew->setAttribute(Qt::WA_StyledBackground, true);-
2738 }-
2739 }-
2740 if (!rule.hasBackground() || rule.background()->isTransparent() || rule.hasBox()-
2741 || (!rule.hasNativeBorder() && !rule.border()->isOpaque()))-
2742 w->setAttribute(Qt::WA_OpaquePaintEvent, false);-
2743 }-
2744}-
2745-
2746void QStyleSheetStyle::polish(QApplication *app)-
2747{-
2748 baseStyle()->polish(app);-
2749}-
2750-
2751void QStyleSheetStyle::polish(QPalette &pal)-
2752{-
2753 baseStyle()->polish(pal);-
2754}-
2755-
2756void QStyleSheetStyle::repolish(QWidget *w)-
2757{-
2758 QList<const QObject *> children = w->findChildren<const QObject *>(QString());-
2759 children.append(w);-
2760 styleSheetCaches->styleSheetCache.remove(w);-
2761 updateObjects(children);-
2762}-
2763-
2764void QStyleSheetStyle::repolish(QApplication *app)-
2765{-
2766 (void)app;;-
2767 const QList<const QObject*> allObjects = styleSheetCaches->styleRulesCache.keys();-
2768 styleSheetCaches->styleSheetCache.remove((static_cast<QApplication *>(QCoreApplication::instance())));-
2769 styleSheetCaches->styleRulesCache.clear();-
2770 styleSheetCaches->hasStyleRuleCache.clear();-
2771 styleSheetCaches->renderRulesCache.clear();-
2772 updateObjects(allObjects);-
2773}-
2774-
2775void QStyleSheetStyle::unpolish(QWidget *w)-
2776{-
2777 if (!w || !w->testAttribute(Qt::WA_StyleSheet)) {-
2778 baseStyle()->unpolish(w);-
2779 return;-
2780 }-
2781-
2782 styleSheetCaches->styleRulesCache.remove(w);-
2783 styleSheetCaches->hasStyleRuleCache.remove(w);-
2784 styleSheetCaches->renderRulesCache.remove(w);-
2785 styleSheetCaches->styleSheetCache.remove(w);-
2786 unsetPalette(w);-
2787 w->setProperty("_q_stylesheet_minw", QVariant());-
2788 w->setProperty("_q_stylesheet_minh", QVariant());-
2789 w->setProperty("_q_stylesheet_maxw", QVariant());-
2790 w->setProperty("_q_stylesheet_maxh", QVariant());-
2791 w->setAttribute(Qt::WA_StyleSheet, false);-
2792 QObject::disconnect(w, 0, this, 0);-
2793-
2794 if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {-
2795 QObject::disconnect(sa->horizontalScrollBar(), qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "2827""2892"),-
2796 sa, qFlagLocation("1""update()" "\0" __FILE__ ":" "2828""2893"));-
2797 QObject::disconnect(sa->verticalScrollBar(), qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "2829""2894"),-
2798 sa, qFlagLocation("1""update()" "\0" __FILE__ ":" "2830""2895"));-
2799 }-
2800-
2801 baseStyle()->unpolish(w);-
2802}-
2803-
2804void QStyleSheetStyle::unpolish(QApplication *app)-
2805{-
2806 baseStyle()->unpolish(app);-
2807 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return; } QStyleSheetStyleRecursionGuard recursion_guard(this);-
2808 styleSheetCaches->styleRulesCache.clear();-
2809 styleSheetCaches->hasStyleRuleCache.clear();-
2810 styleSheetCaches->renderRulesCache.clear();-
2811 styleSheetCaches->styleSheetCache.remove((static_cast<QApplication *>(QCoreApplication::instance())));-
2812}-
2813-
2814-
2815inline static bool verticalTabs(QTabBar::Shape shape)-
2816{-
2817 return shape == QTabBar::RoundedWest-
2818 || shape == QTabBar::RoundedEast-
2819 || shape == QTabBar::TriangularWest-
2820 || shape == QTabBar::TriangularEast;-
2821}-
2822-
2823-
2824void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,-
2825 const QWidget *w) const-
2826{-
2827 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { baseStyle()->drawComplexControl(cc, opt, p, w); return; } QStyleSheetStyleRecursionGuard recursion_guard(this);-
2828-
2829 QRenderRule rule = renderRule(w, opt);-
2830-
2831 switch (cc) {-
2832 case CC_ComboBox:-
2833 if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {-
2834 QStyleOptionComboBox cmbOpt(*cmb);-
2835 cmbOpt.rect = rule.borderRect(opt->rect);-
2836 if (rule.hasNativeBorder()) {-
2837 rule.drawBackgroundImage(p, cmbOpt.rect);-
2838 rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button);-
2839 bool customDropDown = (opt->subControls & QStyle::SC_ComboBoxArrow)-
2840 && (hasStyleRule(w, PseudoElement_ComboBoxDropDown) || hasStyleRule(w, PseudoElement_ComboBoxArrow));-
2841 if (customDropDown)-
2842 cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow;-
2843 if (rule.baseStyleCanDraw()) {-
2844 baseStyle()->drawComplexControl(cc, &cmbOpt, p, w);-
2845 } else {-
2846 QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w);-
2847 }-
2848 if (!customDropDown)-
2849 return;-
2850 } else {-
2851 rule.drawRule(p, opt->rect);-
2852 }-
2853-
2854 if (opt->subControls & QStyle::SC_ComboBoxArrow) {-
2855 QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown);-
2856 if (subRule.hasDrawable()) {-
2857 QRect r = subControlRect(CC_ComboBox, opt, SC_ComboBoxArrow, w);-
2858 subRule.drawRule(p, r);-
2859 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_ComboBoxArrow);-
2860 r = positionRect(w, subRule, subRule2, PseudoElement_ComboBoxArrow, r, opt->direction);-
2861 subRule2.drawRule(p, r);-
2862 } else {-
2863 cmbOpt.subControls = QStyle::SC_ComboBoxArrow;-
2864 QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w);-
2865 }-
2866 }-
2867-
2868 return;-
2869 }-
2870 break;-
2871-
2872-
2873 case CC_SpinBox:-
2874 if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {-
2875 QStyleOptionSpinBox spinOpt(*spin);-
2876 rule.configurePalette(&spinOpt.palette, QPalette::ButtonText, QPalette::Button);-
2877 rule.configurePalette(&spinOpt.palette, QPalette::Text, QPalette::Base);-
2878 spinOpt.rect = rule.borderRect(opt->rect);-
2879 bool customUp = true, customDown = true;-
2880 QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);-
2881 QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);-
2882 bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();-
2883 bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();-
2884 if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) {-
2885 rule.drawBackgroundImage(p, spinOpt.rect);-
2886 customUp = (opt->subControls & QStyle::SC_SpinBoxUp)-
2887 && (hasStyleRule(w, PseudoElement_SpinBoxUpButton) || hasStyleRule(w, PseudoElement_UpArrow));-
2888 if (customUp)-
2889 spinOpt.subControls &= ~QStyle::SC_SpinBoxUp;-
2890 customDown = (opt->subControls & QStyle::SC_SpinBoxDown)-
2891 && (hasStyleRule(w, PseudoElement_SpinBoxDownButton) || hasStyleRule(w, PseudoElement_DownArrow));-
2892 if (customDown)-
2893 spinOpt.subControls &= ~QStyle::SC_SpinBoxDown;-
2894 if (rule.baseStyleCanDraw()) {-
2895 baseStyle()->drawComplexControl(cc, &spinOpt, p, w);-
2896 } else {-
2897 QWindowsStyle::drawComplexControl(cc, &spinOpt, p, w);-
2898 }-
2899 if (!customUp && !customDown)-
2900 return;-
2901 } else {-
2902 rule.drawRule(p, opt->rect);-
2903 }-
2904-
2905 if ((opt->subControls & QStyle::SC_SpinBoxUp) && customUp) {-
2906 QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);-
2907 if (subRule.hasDrawable()) {-
2908 QRect r = subControlRect(CC_SpinBox, opt, SC_SpinBoxUp, w);-
2909 subRule.drawRule(p, r);-
2910 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SpinBoxUpArrow);-
2911 r = positionRect(w, subRule, subRule2, PseudoElement_SpinBoxUpArrow, r, opt->direction);-
2912 subRule2.drawRule(p, r);-
2913 } else {-
2914 spinOpt.subControls = QStyle::SC_SpinBoxUp;-
2915 QWindowsStyle::drawComplexControl(cc, &spinOpt, p, w);-
2916 }-
2917 }-
2918-
2919 if ((opt->subControls & QStyle::SC_SpinBoxDown) && customDown) {-
2920 QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);-
2921 if (subRule.hasDrawable()) {-
2922 QRect r = subControlRect(CC_SpinBox, opt, SC_SpinBoxDown, w);-
2923 subRule.drawRule(p, r);-
2924 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SpinBoxDownArrow);-
2925 r = positionRect(w, subRule, subRule2, PseudoElement_SpinBoxDownArrow, r, opt->direction);-
2926 subRule2.drawRule(p, r);-
2927 } else {-
2928 spinOpt.subControls = QStyle::SC_SpinBoxDown;-
2929 QWindowsStyle::drawComplexControl(cc, &spinOpt, p, w);-
2930 }-
2931 }-
2932 return;-
2933 }-
2934 break;-
2935-
2936-
2937 case CC_GroupBox:-
2938 if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {-
2939-
2940 QRect labelRect, checkBoxRect, titleRect, frameRect;-
2941 bool hasTitle = (gb->subControls & QStyle::SC_GroupBoxCheckBox) || !gb->text.isEmpty();-
2942-
2943 if (!rule.hasDrawable() && (!hasTitle || !hasStyleRule(w, PseudoElement_GroupBoxTitle))-
2944 && !hasStyleRule(w, PseudoElement_Indicator) && !rule.hasBox() && !rule.hasFont && !rule.hasPalette()) {-
2945-
2946 break;-
2947 }-
2948 rule.drawBackground(p, opt->rect);-
2949-
2950 QRenderRule titleRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);-
2951 bool clipSet = false;-
2952-
2953 if (hasTitle) {-
2954 labelRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, w);-
2955-
2956 labelRect.setSize(labelRect.size().expandedTo(ParentStyle::subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, w).size()));-
2957 if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {-
2958 checkBoxRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, w);-
2959 titleRect = titleRule.boxRect(checkBoxRect.united(labelRect));-
2960 } else {-
2961 titleRect = titleRule.boxRect(labelRect);-
2962 }-
2963 if (!titleRule.hasBackground() || !titleRule.background()->isTransparent()) {-
2964 clipSet = true;-
2965 p->save();-
2966 p->setClipRegion(QRegion(opt->rect) - titleRect);-
2967 }-
2968 }-
2969-
2970 frameRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, w);-
2971 QStyleOptionFrame frame;-
2972 frame.QStyleOption::operator=(*gb);-
2973 frame.features = gb->features;-
2974 frame.lineWidth = gb->lineWidth;-
2975 frame.midLineWidth = gb->midLineWidth;-
2976 frame.rect = frameRect;-
2977 drawPrimitive(PE_FrameGroupBox, &frame, p, w);-
2978-
2979 if (clipSet)-
2980 p->restore();-
2981-
2982-
2983 if (hasTitle)-
2984 titleRule.drawRule(p, titleRect);-
2985-
2986-
2987 if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {-
2988 QStyleOptionButton box;-
2989 box.QStyleOption::operator=(*gb);-
2990 box.rect = checkBoxRect;-
2991 drawPrimitive(PE_IndicatorCheckBox, &box, p, w);-
2992 }-
2993-
2994-
2995 if (!gb->text.isEmpty()) {-
2996 int alignment = int(Qt::AlignCenter | Qt::TextShowMnemonic);-
2997 if (!styleHint(QStyle::SH_UnderlineShortcut, opt, w)) {-
2998 alignment |= Qt::TextHideMnemonic;-
2999 }-
3000-
3001 QPalette pal = gb->palette;-
3002 if (gb->textColor.isValid())-
3003 pal.setColor(QPalette::WindowText, gb->textColor);-
3004 titleRule.configurePalette(&pal, QPalette::WindowText, QPalette::Window);-
3005 drawItemText(p, labelRect, alignment, pal, gb->state & State_Enabled,-
3006 gb->text, QPalette::WindowText);-
3007-
3008 if (gb->state & State_HasFocus) {-
3009 QStyleOptionFocusRect fropt;-
3010 fropt.QStyleOption::operator=(*gb);-
3011 fropt.rect = labelRect;-
3012 drawPrimitive(PE_FrameFocusRect, &fropt, p, w);-
3013 }-
3014 }-
3015-
3016 return;-
3017 }-
3018 break;-
3019-
3020 case CC_ToolButton:-
3021 if (const QStyleOptionToolButton *tool = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {-
3022 QStyleOptionToolButton toolOpt(*tool);-
3023 rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button);-
3024 toolOpt.font = rule.font.resolve(toolOpt.font);-
3025 toolOpt.rect = rule.borderRect(opt->rect);-
3026 bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup));-
3027 bool customDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup;-
3028 if (rule.hasNativeBorder()) {-
3029 if (tool->subControls & SC_ToolButton) {-
3030-
3031-
3032-
3033 State bflags = tool->state & ~State_Sunken;-
3034 if (bflags & State_AutoRaise && (!(bflags & State_MouseOver) || !(bflags & State_Enabled)))-
3035 bflags &= ~State_Raised;-
3036 if (tool->state & State_Sunken && tool->activeSubControls & SC_ToolButton)-
3037 bflags |= State_Sunken;-
3038 if (!(bflags & (State_Sunken | State_On | State_Raised)))-
3039 rule.drawBackground(p, toolOpt.rect);-
3040 }-
3041 customArrow = customArrow && hasStyleRule(w, PseudoElement_ToolButtonDownArrow);-
3042 if (customArrow)-
3043 toolOpt.features &= ~QStyleOptionToolButton::HasMenu;-
3044 customDropDown = customDropDown && hasStyleRule(w, PseudoElement_ToolButtonMenu);-
3045 if (customDropDown)-
3046 toolOpt.subControls &= ~QStyle::SC_ToolButtonMenu;-
3047-
3048 if (rule.baseStyleCanDraw() && !(tool->features & QStyleOptionToolButton::Arrow)) {-
3049 baseStyle()->drawComplexControl(cc, &toolOpt, p, w);-
3050 } else {-
3051 QWindowsStyle::drawComplexControl(cc, &toolOpt, p, w);-
3052 }-
3053-
3054 if (!customArrow && !customDropDown)-
3055 return;-
3056 } else {-
3057 rule.drawRule(p, opt->rect);-
3058 toolOpt.rect = rule.contentsRect(opt->rect);-
3059 if (rule.hasFont)-
3060 toolOpt.font = rule.font;-
3061 drawControl(CE_ToolButtonLabel, &toolOpt, p, w);-
3062 }-
3063-
3064 QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu);-
3065 QRect r = subControlRect(CC_ToolButton, opt, QStyle::SC_ToolButtonMenu, w);-
3066 if (customDropDown) {-
3067 if (opt->subControls & QStyle::SC_ToolButtonMenu) {-
3068 if (subRule.hasDrawable()) {-
3069 subRule.drawRule(p, r);-
3070 } else {-
3071 toolOpt.rect = r;-
3072 baseStyle()->drawPrimitive(PE_IndicatorButtonDropDown, &toolOpt, p, w);-
3073 }-
3074 }-
3075 }-
3076-
3077 if (customArrow) {-
3078 QRenderRule subRule2 = customDropDown ? renderRule(w, opt, PseudoElement_ToolButtonMenuArrow)-
3079 : renderRule(w, opt, PseudoElement_ToolButtonDownArrow);-
3080 QRect r2 = customDropDown-
3081 ? positionRect(w, subRule, subRule2, PseudoElement_ToolButtonMenuArrow, r, opt->direction)-
3082 : positionRect(w, rule, subRule2, PseudoElement_ToolButtonDownArrow, opt->rect, opt->direction);-
3083 if (subRule2.hasDrawable()) {-
3084 subRule2.drawRule(p, r2);-
3085 } else {-
3086 toolOpt.rect = r2;-
3087 baseStyle()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &toolOpt, p, w);-
3088 }-
3089 }-
3090-
3091 return;-
3092 }-
3093 break;-
3094-
3095-
3096 case CC_ScrollBar:-
3097 if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {-
3098 QStyleOptionSlider sbOpt(*sb);-
3099 if (!rule.hasDrawable()) {-
3100 sbOpt.rect = rule.borderRect(opt->rect);-
3101 rule.drawBackgroundImage(p, opt->rect);-
3102 baseStyle()->drawComplexControl(cc, &sbOpt, p, w);-
3103 } else {-
3104 rule.drawRule(p, opt->rect);-
3105 QWindowsStyle::drawComplexControl(cc, opt, p, w);-
3106 }-
3107 return;-
3108 }-
3109 break;-
3110-
3111-
3112-
3113 case CC_Slider:-
3114 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {-
3115 rule.drawRule(p, opt->rect);-
3116-
3117 QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove);-
3118 QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle);-
3119 if (!grooveSubRule.hasDrawable()) {-
3120 QStyleOptionSlider slOpt(*slider);-
3121 bool handleHasRule = handleSubRule.hasDrawable();-
3122-
3123 if (handleHasRule)-
3124 slOpt.subControls &= ~SC_SliderHandle;-
3125 baseStyle()->drawComplexControl(cc, &slOpt, p, w);-
3126 if (!handleHasRule)-
3127 return;-
3128 }-
3129-
3130 QRect gr = subControlRect(cc, opt, SC_SliderGroove, w);-
3131 if (slider->subControls & SC_SliderGroove) {-
3132 grooveSubRule.drawRule(p, gr);-
3133 }-
3134-
3135 if (slider->subControls & SC_SliderHandle) {-
3136 QRect hr = subControlRect(cc, opt, SC_SliderHandle, w);-
3137-
3138 QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SliderSubPage);-
3139 if (subRule1.hasDrawable()) {-
3140 QRect r(gr.topLeft(),-
3141 slider->orientation == Qt::Horizontal-
3142 ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() - 1)-
3143 : QPoint(gr.x()+gr.width() - 1, hr.y()+hr.height()/2));-
3144 subRule1.drawRule(p, r);-
3145 }-
3146-
3147 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SliderAddPage);-
3148 if (subRule2.hasDrawable()) {-
3149 QRect r(slider->orientation == Qt::Horizontal-
3150 ? QPoint(hr.x()+hr.width()/2+1, gr.y())-
3151 : QPoint(gr.x(), hr.y()+hr.height()/2+1),-
3152 gr.bottomRight());-
3153 subRule2.drawRule(p, r);-
3154 }-
3155-
3156 handleSubRule.drawRule(p, handleSubRule.boxRect(hr, Margin));-
3157 }-
3158-
3159 if (slider->subControls & SC_SliderTickmarks) {-
3160-
3161 }-
3162-
3163 return;-
3164 }-
3165 break;-
3166-
3167-
3168 case CC_MdiControls:-
3169 if (hasStyleRule(w, PseudoElement_MdiCloseButton)-
3170 || hasStyleRule(w, PseudoElement_MdiNormalButton)-
3171 || hasStyleRule(w, PseudoElement_MdiMinButton)) {-
3172 QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList();-
3173 if (layout.isEmpty())-
3174 layout = subControlLayout(QLatin1String("mNX"));-
3175-
3176 QStyleOptionComplex optCopy(*opt);-
3177 optCopy.subControls = 0;-
3178 for (int i = 0; i < layout.count(); i++) {-
3179 int layoutButton = layout[i].toInt();-
3180 if (layoutButton < PseudoElement_MdiCloseButton-
3181 || layoutButton > PseudoElement_MdiNormalButton)-
3182 continue;-
3183 QStyle::SubControl control = knownPseudoElements[layoutButton].subControl;-
3184 if (!(opt->subControls & control))-
3185 continue;-
3186 QRenderRule subRule = renderRule(w, opt, layoutButton);-
3187 if (subRule.hasDrawable()) {-
3188 QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin);-
3189 subRule.drawRule(p, rect);-
3190 QIcon icon = standardIcon(subControlIcon(layoutButton), opt);-
3191 icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter);-
3192 } else {-
3193 optCopy.subControls |= control;-
3194 }-
3195 }-
3196-
3197 if (optCopy.subControls)-
3198 baseStyle()->drawComplexControl(CC_MdiControls, &optCopy, p, w);-
3199 return;-
3200 }-
3201 break;-
3202-
3203 case CC_TitleBar:-
3204 if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {-
3205 QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar);-
3206 if (!subRule.hasDrawable() && !subRule.hasBox() && !subRule.hasBorder())-
3207 break;-
3208 subRule.drawRule(p, opt->rect);-
3209 QHash<QStyle::SubControl, QRect> layout = titleBarLayout(w, tb);-
3210-
3211 QRect ir;-
3212 ir = layout[SC_TitleBarLabel];-
3213 if (ir.isValid()) {-
3214 if (subRule.hasPalette())-
3215 p->setPen(subRule.palette()->foreground.color());-
3216 p->fillRect(ir, Qt::white);-
3217 p->drawText(ir.x(), ir.y(), ir.width(), ir.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text);-
3218 }-
3219-
3220 QPixmap pm;-
3221-
3222 ir = layout[SC_TitleBarSysMenu];-
3223 if (ir.isValid()) {-
3224 QRenderRule subSubRule = renderRule(w, opt, PseudoElement_TitleBarSysMenu);-
3225 subSubRule.drawRule(p, ir);-
3226 ir = subSubRule.contentsRect(ir);-
3227 if (!tb->icon.isNull()) {-
3228 tb->icon.paint(p, ir);-
3229 } else {-
3230 int iconSize = pixelMetric(PM_SmallIconSize, tb, w);-
3231 pm = standardIcon(SP_TitleBarMenuButton, 0, w).pixmap(iconSize, iconSize);-
3232 drawItemPixmap(p, ir, Qt::AlignCenter, pm);-
3233 }-
3234 }-
3235-
3236 ir = layout[SC_TitleBarCloseButton];-
3237 if (ir.isValid()) {-
3238 QRenderRule subSubRule = renderRule(w, opt, PseudoElement_TitleBarCloseButton);-
3239 subSubRule.drawRule(p, ir);-
3240-
3241 QSize sz = subSubRule.contentsRect(ir).size();-
3242 if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool)-
3243 pm = standardIcon(SP_DockWidgetCloseButton, 0, w).pixmap(sz);-
3244 else-
3245 pm = standardIcon(SP_TitleBarCloseButton, 0, w).pixmap(sz);-
3246 drawItemPixmap(p, ir, Qt::AlignCenter, pm);-
3247 }-
3248-
3249 int pes[] = {-
3250 PseudoElement_TitleBarMaxButton,-
3251 PseudoElement_TitleBarMinButton,-
3252 PseudoElement_TitleBarNormalButton,-
3253 PseudoElement_TitleBarShadeButton,-
3254 PseudoElement_TitleBarUnshadeButton,-
3255 PseudoElement_TitleBarContextHelpButton-
3256 };-
3257-
3258 for (unsigned int i = 0; i < sizeof(pes)/sizeof(int); i++) {-
3259 int pe = pes[i];-
3260 QStyle::SubControl sc = knownPseudoElements[pe].subControl;-
3261 ir = layout[sc];-
3262 if (!ir.isValid())-
3263 continue;-
3264 QRenderRule subSubRule = renderRule(w, opt, pe);-
3265 subSubRule.drawRule(p, ir);-
3266 pm = standardIcon(subControlIcon(pe), 0, w).pixmap(subSubRule.contentsRect(ir).size());-
3267 drawItemPixmap(p, ir, Qt::AlignCenter, pm);-
3268 }-
3269-
3270 return;-
3271 }-
3272 break;-
3273-
3274-
3275 default:-
3276 break;-
3277 }-
3278-
3279 baseStyle()->drawComplexControl(cc, opt, p, w);-
3280}-
3281-
3282void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p,-
3283 const QWidget *w) const-
3284{-
3285 if (globalStyleSheetStyle != 0
globalStyleSheetStyle != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& globalStyleSheetStyle != this
globalStyleSheetStyle != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) { baseStyle()->drawControl(ce, opt, p, w); return;
never executed: return;
} QStyleSheetStyleRecursionGuard recursion_guard(this);
0
3286-
3287 QRenderRule rule = renderRule(w, opt);-
3288 int pe1 = PseudoElement_None, pe2 = PseudoElement_None;-
3289 bool fallback = false;-
3290-
3291 switch (ce) {-
3292 case
never executed: case CE_ToolButtonLabel:
CE_ToolButtonLabel:
never executed: case CE_ToolButtonLabel:
0
3293 if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionToolButton *btn = qstyleoption_cast<const QStyleOptionToolButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3294 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| btn->features & QStyleOptionToolButton::Arrow
btn->features ...lButton::ArrowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3295 QCommonStyle::drawControl(ce, opt, p, w);-
3296 }
never executed: end of block
else {
0
3297 QStyleOptionToolButton butOpt(*btn);-
3298 rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);-
3299 baseStyle()->drawControl(ce, &butOpt, p, w);-
3300 }
never executed: end of block
0
3301 return;
never executed: return;
0
3302 }-
3303 break;
never executed: break;
0
3304-
3305 case
never executed: case CE_FocusFrame:
CE_FocusFrame:
never executed: case CE_FocusFrame:
0
3306 if (!rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3307 rule.drawBorder(p, opt->rect);-
3308 return;
never executed: return;
0
3309 }-
3310 break;
never executed: break;
0
3311-
3312 case
never executed: case CE_PushButton:
CE_PushButton:
never executed: case CE_PushButton:
0
3313 if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3314 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
|| rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| rule.hasPosition()
rule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
|| rule.hasPalette()
rule.hasPalette()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
3315 ((
(btn->features...tton::HasMenu)Description
TRUEnever evaluated
FALSEnever evaluated
btn->features & QStyleOptionButton::HasMenu)
(btn->features...tton::HasMenu)Description
TRUEnever evaluated
FALSEnever evaluated
&& hasStyleRule(w, PseudoElement_PushButtonMenuIndicator)
hasStyleRule(w...MenuIndicator)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
3316 ParentStyle::drawControl(ce, opt, p, w);-
3317 return;
never executed: return;
0
3318 }-
3319 }
never executed: end of block
0
3320 break;
never executed: break;
0
3321 case
never executed: case CE_PushButtonBevel:
CE_PushButtonBevel:
never executed: case CE_PushButtonBevel:
0
3322 if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3323 QStyleOptionButton btnOpt(*btn);-
3324 btnOpt.rect = rule.borderRect(opt->rect);-
3325 if (rule.hasNativeBorder()
rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3326 rule.drawBackgroundImage(p, btnOpt.rect);-
3327 rule.configurePalette(&btnOpt.palette, QPalette::ButtonText, QPalette::Button);-
3328 bool customMenu = (btn->features & QStyleOptionButton::HasMenu
btn->features ...utton::HasMenuDescription
TRUEnever evaluated
FALSEnever evaluated
0
3329 && hasStyleRule(w, PseudoElement_PushButtonMenuIndicator)
hasStyleRule(w...MenuIndicator)Description
TRUEnever evaluated
FALSEnever evaluated
);
0
3330 if (customMenu
customMenuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3331 btnOpt.features &= ~QStyleOptionButton::HasMenu;
never executed: btnOpt.features &= ~QStyleOptionButton::HasMenu;
0
3332 if (rule.baseStyleCanDraw()
rule.baseStyleCanDraw()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3333 baseStyle()->drawControl(ce, &btnOpt, p, w);-
3334 }
never executed: end of block
else {
0
3335 QWindowsStyle::drawControl(ce, &btnOpt, p, w);-
3336 }
never executed: end of block
0
3337 if (!customMenu
!customMenuDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3338 return;
never executed: return;
0
3339 }
never executed: end of block
else {
0
3340 rule.drawRule(p, opt->rect);-
3341 }
never executed: end of block
0
3342-
3343 if (btn->features & QStyleOptionButton::HasMenu
btn->features ...utton::HasMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3344 QRenderRule subRule = renderRule(w, opt, PseudoElement_PushButtonMenuIndicator);-
3345 QRect ir = positionRect(w, rule, subRule, PseudoElement_PushButtonMenuIndicator, opt->rect, opt->direction);-
3346 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3347 subRule.drawRule(p, ir);-
3348 }
never executed: end of block
else {
0
3349 btnOpt.rect = ir;-
3350 baseStyle()->drawPrimitive(PE_IndicatorArrowDown, &btnOpt, p, w);-
3351 }
never executed: end of block
0
3352 }-
3353 }
never executed: end of block
0
3354 return;
never executed: return;
0
3355-
3356 case
never executed: case CE_PushButtonLabel:
CE_PushButtonLabel:
never executed: case CE_PushButtonLabel:
0
3357 if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3358 QStyleOptionButton butOpt(*button);-
3359 rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);-
3360-
3361 const QFont oldFont = p->font();-
3362 if (rule.hasFont
rule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3363 p->setFont(rule.font);
never executed: p->setFont(rule.font);
0
3364-
3365 if (rule.hasPosition()
rule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
&& rule.position()->textAlignment != 0
rule.position(...Alignment != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3366 Qt::Alignment textAlignment = rule.position()->textAlignment;-
3367 QRect textRect = button->rect;-
3368 uint tf = Qt::TextShowMnemonic;-
3369 const uint verticalAlignMask = Qt::AlignVCenter | Qt::AlignTop | Qt::AlignLeft;-
3370 tf |= (
(textAlignment...icalAlignMask)Description
TRUEnever evaluated
FALSEnever evaluated
textAlignment & verticalAlignMask)
(textAlignment...icalAlignMask)Description
TRUEnever evaluated
FALSEnever evaluated
? (textAlignment & verticalAlignMask) : Qt::AlignVCenter;
0
3371 if (!styleHint(SH_UnderlineShortcut, button, w)
!styleHint(SH_...ut, button, w)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3372 tf |= Qt::TextHideMnemonic;
never executed: tf |= Qt::TextHideMnemonic;
0
3373 if (!button->icon.isNull()
!button->icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3374-
3375 QRect iconRect;-
3376 QIcon::Mode mode = button->state & State_Enabled
button->state & State_EnabledDescription
TRUEnever evaluated
FALSEnever evaluated
? QIcon::Normal : QIcon::Disabled;
0
3377 if (mode == QIcon::Normal
mode == QIcon::NormalDescription
TRUEnever evaluated
FALSEnever evaluated
&& button->state & State_HasFocus
button->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3378 mode = QIcon::Active;
never executed: mode = QIcon::Active;
0
3379 QIcon::State state = QIcon::Off;-
3380 if (button->state & State_On
button->state & State_OnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3381 state = QIcon::On;
never executed: state = QIcon::On;
0
3382-
3383 QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);-
3384 int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio();-
3385 int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio();-
3386 int labelWidth = pixmapWidth;-
3387 int labelHeight = pixmapHeight;-
3388 int iconSpacing = 4;-
3389 int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width();-
3390 if (!button->text.isEmpty()
!button->text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3391 labelWidth += (textWidth + iconSpacing);
never executed: labelWidth += (textWidth + iconSpacing);
0
3392-
3393-
3394 if (textAlignment & Qt::AlignLeft
textAlignment & Qt::AlignLeftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3395 iconRect = QRect(textRect.x(), textRect.y() + (textRect.height() - labelHeight) / 2,-
3396 pixmapWidth, pixmapHeight);-
3397 }
never executed: end of block
else if (textAlignment & Qt::AlignHCenter
textAlignment ...::AlignHCenterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3398 iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2,-
3399 textRect.y() + (textRect.height() - labelHeight) / 2,-
3400 pixmapWidth, pixmapHeight);-
3401 }
never executed: end of block
else {
0
3402 iconRect = QRect(textRect.x() + textRect.width() - labelWidth,-
3403 textRect.y() + (textRect.height() - labelHeight) / 2,-
3404 pixmapWidth, pixmapHeight);-
3405 }
never executed: end of block
0
3406-
3407 iconRect = visualRect(button->direction, textRect, iconRect);-
3408-
3409 tf |= Qt::AlignLeft;-
3410-
3411 if (button->direction == Qt::RightToLeft
button->direct...t::RightToLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3412 textRect.setRight(iconRect.left() - iconSpacing);
never executed: textRect.setRight(iconRect.left() - iconSpacing);
0
3413 else-
3414 textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing);
never executed: textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing);
0
3415-
3416 if (button->state & (State_On | State_Sunken)
button->state ... State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3417 iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w),
never executed: iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w));
0
3418 pixelMetric(PM_ButtonShiftVertical, opt, w));
never executed: iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w));
0
3419 p->drawPixmap(iconRect, pixmap);-
3420 }
never executed: end of block
else {
0
3421 tf |= textAlignment;-
3422 }
never executed: end of block
0
3423 if (button->state & (State_On | State_Sunken)
button->state ... State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3424 textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w),
never executed: textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w));
0
3425 pixelMetric(PM_ButtonShiftVertical, opt, w));
never executed: textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w));
0
3426-
3427 if (button->features & QStyleOptionButton::HasMenu
button->featur...utton::HasMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3428 int indicatorSize = pixelMetric(PM_MenuButtonIndicator, button, w);-
3429 if (button->direction == Qt::LeftToRight
button->direct...t::LeftToRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3430 textRect = textRect.adjusted(0, 0, -indicatorSize, 0);
never executed: textRect = textRect.adjusted(0, 0, -indicatorSize, 0);
0
3431 else-
3432 textRect = textRect.adjusted(indicatorSize, 0, 0, 0);
never executed: textRect = textRect.adjusted(indicatorSize, 0, 0, 0);
0
3433 }-
3434 drawItemText(p, textRect, tf, butOpt.palette, (button->state & State_Enabled),-
3435 button->text, QPalette::ButtonText);-
3436 }
never executed: end of block
else {
0
3437 ParentStyle::drawControl(ce, &butOpt, p, w);-
3438 }
never executed: end of block
0
3439-
3440 if (rule.hasFont
rule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3441 p->setFont(oldFont);
never executed: p->setFont(oldFont);
0
3442 }
never executed: end of block
0
3443 return;
never executed: return;
0
3444-
3445 case
never executed: case CE_RadioButton:
CE_RadioButton:
never executed: case CE_RadioButton:
0
3446 case
never executed: case CE_CheckBox:
CE_CheckBox:
never executed: case CE_CheckBox:
0
3447 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| !rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
|| rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
|| hasStyleRule(w, PseudoElement_Indicator)
hasStyleRule(w...ent_Indicator)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3448 rule.drawRule(p, opt->rect);-
3449 ParentStyle::drawControl(ce, opt, p, w);-
3450 return;
never executed: return;
0
3451 } else if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3452 QStyleOptionButton butOpt(*btn);-
3453 rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);-
3454 baseStyle()->drawControl(ce, &butOpt, p, w);-
3455 return;
never executed: return;
0
3456 }-
3457 break;
never executed: break;
0
3458 case
never executed: case CE_RadioButtonLabel:
CE_RadioButtonLabel:
never executed: case CE_RadioButtonLabel:
0
3459 case
never executed: case CE_CheckBoxLabel:
CE_CheckBoxLabel:
never executed: case CE_CheckBoxLabel:
0
3460 if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3461 QStyleOptionButton butOpt(*btn);-
3462 rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);-
3463 ParentStyle::drawControl(ce, &butOpt, p, w);-
3464 }
never executed: end of block
0
3465 return;
never executed: return;
0
3466-
3467 case
never executed: case CE_Splitter:
CE_Splitter:
never executed: case CE_Splitter:
0
3468 pe1 = PseudoElement_SplitterHandle;-
3469 break;
never executed: break;
0
3470-
3471 case
never executed: case CE_ToolBar:
CE_ToolBar:
never executed: case CE_ToolBar:
0
3472 if (rule.hasBackground()
rule.hasBackground()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3473 rule.drawBackground(p, opt->rect);-
3474 }
never executed: end of block
0
3475 if (rule.hasBorder()
rule.hasBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3476 rule.drawBorder(p, rule.borderRect(opt->rect));-
3477 }
never executed: end of block
else {
0
3478-
3479 if (const
const QStyleOp...oolBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)
const QStyleOp...oolBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3480 QStyleOptionToolBar newTb(*tb);-
3481 newTb.rect = rule.borderRect(opt->rect);-
3482 baseStyle()->drawControl(ce, &newTb, p, w);-
3483 }
never executed: end of block
0
3484-
3485 }
never executed: end of block
0
3486 return;
never executed: return;
0
3487-
3488 case
never executed: case CE_MenuEmptyArea:
CE_MenuEmptyArea:
never executed: case CE_MenuEmptyArea:
0
3489 case
never executed: case CE_MenuBarEmptyArea:
CE_MenuBarEmptyArea:
never executed: case CE_MenuBarEmptyArea:
0
3490 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3491-
3492 return;
never executed: return;
0
3493 }-
3494 break;
never executed: break;
0
3495-
3496 case
never executed: case CE_MenuTearoff:
CE_MenuTearoff:
never executed: case CE_MenuTearoff:
0
3497 case
never executed: case CE_MenuScroller:
CE_MenuScroller:
never executed: case CE_MenuScroller:
0
3498 if (const
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3499 QStyleOptionMenuItem mi(*m);-
3500 int pe = ce == CE_MenuTearoff
ce == CE_MenuTearoffDescription
TRUEnever evaluated
FALSEnever evaluated
? PseudoElement_MenuTearoff : PseudoElement_MenuScroller;
0
3501 QRenderRule subRule = renderRule(w, opt, pe);-
3502 mi.rect = subRule.contentsRect(opt->rect);-
3503 rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);-
3504 subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);-
3505-
3506 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3507 subRule.drawRule(p, opt->rect);-
3508 }
never executed: end of block
else {
0
3509 baseStyle()->drawControl(ce, &mi, p, w);-
3510 }
never executed: end of block
0
3511 }-
3512 return;
never executed: return;
0
3513-
3514 case
never executed: case CE_MenuItem:
CE_MenuItem:
never executed: case CE_MenuItem:
0
3515 if (const
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3516 QStyleOptionMenuItem mi(*m);-
3517-
3518 int pseudo = (
(mi.menuItemTy...em::Separator)Description
TRUEnever evaluated
FALSEnever evaluated
mi.menuItemType == QStyleOptionMenuItem::Separator)
(mi.menuItemTy...em::Separator)Description
TRUEnever evaluated
FALSEnever evaluated
? PseudoElement_MenuSeparator : PseudoElement_Item;
0
3519 QRenderRule subRule = renderRule(w, opt, pseudo);-
3520 mi.rect = subRule.contentsRect(opt->rect);-
3521 rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);-
3522 rule.configurePalette(&mi.palette, QPalette::HighlightedText, QPalette::Highlight);-
3523 subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);-
3524 subRule.configurePalette(&mi.palette, QPalette::HighlightedText, QPalette::Highlight);-
3525 QFont oldFont = p->font();-
3526 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3527 p->setFont(subRule.font.resolve(p->font()));
never executed: p->setFont(subRule.font.resolve(p->font()));
0
3528-
3529-
3530-
3531 QRenderRule allRules = renderRule(w, PseudoElement_Item, PseudoClass_Any);-
3532-
3533 if ((
(pseudo == Pse...MenuSeparator)Description
TRUEnever evaluated
FALSEnever evaluated
pseudo == PseudoElement_MenuSeparator)
(pseudo == Pse...MenuSeparator)Description
TRUEnever evaluated
FALSEnever evaluated
&& subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3534 subRule.drawRule(p, opt->rect);-
3535 }
never executed: end of block
else if ((
(pseudo == PseudoElement_Item)Description
TRUEnever evaluated
FALSEnever evaluated
pseudo == PseudoElement_Item)
(pseudo == PseudoElement_Item)Description
TRUEnever evaluated
FALSEnever evaluated
0
3536 && (allRules.hasBox()
allRules.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| allRules.hasBorder()
allRules.hasBorder()Description
TRUEnever evaluated
FALSEnever evaluated
0
3537 || (allRules.background()
allRules.background()Description
TRUEnever evaluated
FALSEnever evaluated
&& !allRules.background()->pixmap.isNull()
!allRules.back...ixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
))) {
0
3538 subRule.drawRule(p, opt->rect);-
3539 if (subRule.hasBackground()
subRule.hasBackground()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3540 mi.palette.setBrush(QPalette::Highlight, Qt::NoBrush);-
3541 mi.palette.setBrush(QPalette::Button, Qt::NoBrush);-
3542 }
never executed: end of block
else {
0
3543 mi.palette.setBrush(QPalette::Highlight, mi.palette.brush(QPalette::Button));-
3544 }
never executed: end of block
0
3545 mi.palette.setBrush(QPalette::HighlightedText, mi.palette.brush(QPalette::ButtonText));-
3546-
3547 bool checkable = mi.checkType != QStyleOptionMenuItem::NotCheckable;-
3548 bool checked = checkable
checkableDescription
TRUEnever evaluated
FALSEnever evaluated
? mi.checked : false;
0
3549-
3550 bool dis = !(opt->state & QStyle::State_Enabled),-
3551 act = opt->state & QStyle::State_Selected;-
3552-
3553 if (!mi.icon.isNull()
!mi.icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3554 QIcon::Mode mode = dis
disDescription
TRUEnever evaluated
FALSEnever evaluated
? QIcon::Disabled : QIcon::Normal;
0
3555 if (act
actDescription
TRUEnever evaluated
FALSEnever evaluated
&& !dis
!disDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3556 mode = QIcon::Active;
never executed: mode = QIcon::Active;
0
3557 QPixmap pixmap;-
3558 if (checked
checkedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3559 pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
never executed: pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
0
3560 else-
3561 pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
never executed: pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
0
3562 const int pixw = pixmap.width() / pixmap.devicePixelRatio();-
3563 const int pixh = pixmap.height() / pixmap.devicePixelRatio();-
3564 QRenderRule iconRule = renderRule(w, opt, PseudoElement_MenuIcon);-
3565 if (!iconRule.hasGeometry()
!iconRule.hasGeometry()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3566 iconRule.geo = new QStyleSheetGeometryData(pixw, pixh, pixw, pixh, -1, -1);-
3567 }
never executed: end of block
else {
0
3568 iconRule.geo->width = pixw;-
3569 iconRule.geo->height = pixh;-
3570 }
never executed: end of block
0
3571 QRect iconRect = positionRect(w, subRule, iconRule, PseudoElement_MenuIcon, opt->rect, opt->direction);-
3572 iconRule.drawRule(p, iconRect);-
3573 QRect pmr(0, 0, pixw, pixh);-
3574 pmr.moveCenter(iconRect.center());-
3575 p->drawPixmap(pmr.topLeft(), pixmap);-
3576 }
never executed: end of block
else if (checkable
checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3577 QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);-
3578 if (subSubRule.hasDrawable()
subSubRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
|| checked
checkedDescription
TRUEnever evaluated
FALSEnever evaluated
)
{
0
3579 QStyleOptionMenuItem newMi = mi;-
3580 newMi.rect = positionRect(w, subRule, subSubRule, PseudoElement_MenuCheckMark, opt->rect, opt->direction);-
3581 drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w);-
3582 }
never executed: end of block
0
3583 }
never executed: end of block
0
3584-
3585 QRect textRect = subRule.contentsRect(opt->rect);-
3586 textRect.setWidth(textRect.width() - mi.tabWidth);-
3587 QStringQStringRef s= mi(&mi.text;);-
3588 p->setPen(mi.palette.buttonText().color());-
3589 if (!s.isEmpty()
!s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3590 int text_flags = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;-
3591 if (!styleHint(SH_UnderlineShortcut, &mi, w)
!styleHint(SH_...rtcut, &mi, w)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3592 text_flags |= Qt::TextHideMnemonic;
never executed: text_flags |= Qt::TextHideMnemonic;
0
3593 int t = s.indexOf(QLatin1Char('\t'));-
3594 if (t >= 0
t >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3595 QRect vShortcutRect = visualRect(opt->direction, mi.rect,-
3596 QRect(textRect.topRight(), QPoint(mi.rect.right(), textRect.bottom())));-
3597 p->drawText(vShortcutRect, text_flags, s.mid(t + 1));).toString());-
3598 s = s.left(t);-
3599 }
never executed: end of block
0
3600 p->drawText(textRect, text_flags, s.left(t));).toString());-
3601 }
never executed: end of block
0
3602-
3603 if (mi.menuItemType == QStyleOptionMenuItem::SubMenu
mi.menuItemTyp...uItem::SubMenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3604 PrimitiveElement arrow = (
(opt->directio...::RightToLeft)Description
TRUEnever evaluated
FALSEnever evaluated
opt->direction == Qt::RightToLeft)
(opt->directio...::RightToLeft)Description
TRUEnever evaluated
FALSEnever evaluated
? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
0
3605 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_MenuRightArrow);-
3606 mi.rect = positionRect(w, subRule, subRule2, PseudoElement_MenuRightArrow, opt->rect, mi.direction);-
3607 drawPrimitive(arrow, &mi, p, w);-
3608 }
never executed: end of block
0
3609 }
never executed: end of block
else if (hasStyleRule(w, PseudoElement_MenuCheckMark)
hasStyleRule(w...MenuCheckMark)Description
TRUEnever evaluated
FALSEnever evaluated
|| hasStyleRule(w, PseudoElement_MenuRightArrow)
hasStyleRule(w...enuRightArrow)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3610 QWindowsStyle::drawControl(ce, &mi, p, w);-
3611 if (mi.checkType != QStyleOptionMenuItem::NotCheckable
mi.checkType !...::NotCheckableDescription
TRUEnever evaluated
FALSEnever evaluated
&& !mi.checked
!mi.checkedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3612-
3613-
3614 int checkcol = qMax<int>(mi.maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);-
3615 QRect vCheckRect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x(), mi.rect.y(), checkcol, mi.rect.height()));-
3616 if (mi.state.testFlag(State_Enabled)
mi.state.testF...State_Enabled)Description
TRUEnever evaluated
FALSEnever evaluated
&& mi.state.testFlag(State_Selected)
mi.state.testF...tate_Selected)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3617 qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &mi.palette.brush(QPalette::Button));-
3618 }
never executed: end of block
else {
0
3619 QBrush fill(mi.palette.light().color(), Qt::Dense4Pattern);-
3620 qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &fill);-
3621 }
never executed: end of block
0
3622 QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);-
3623 if (subSubRule.hasDrawable()
subSubRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3624 QStyleOptionMenuItem newMi(mi);-
3625 newMi.rect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x() + QWindowsStylePrivate::windowsItemFrame,-
3626 mi.rect.y() + QWindowsStylePrivate::windowsItemFrame,-
3627 checkcol - 2 * QWindowsStylePrivate::windowsItemFrame,-
3628 mi.rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame));-
3629 drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w);-
3630 }
never executed: end of block
0
3631 }
never executed: end of block
0
3632 }
never executed: end of block
else {
0
3633 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
&& !subRule.hasDrawable()
!subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
&& !(opt->state & QStyle::State_Selected)
!(opt->state &...tate_Selected)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3634 mi.palette.setColor(QPalette::Window, Qt::transparent);-
3635 mi.palette.setColor(QPalette::Button, Qt::transparent);-
3636 }
never executed: end of block
0
3637 if (rule.baseStyleCanDraw()
rule.baseStyleCanDraw()Description
TRUEnever evaluated
FALSEnever evaluated
&& subRule.baseStyleCanDraw()
subRule.baseStyleCanDraw()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3638 baseStyle()->drawControl(ce, &mi, p, w);-
3639 }
never executed: end of block
else {
0
3640 ParentStyle::drawControl(ce, &mi, p, w);-
3641 }
never executed: end of block
0
3642 }-
3643-
3644 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3645 p->setFont(oldFont);
never executed: p->setFont(oldFont);
0
3646-
3647 return;
never executed: return;
0
3648 }-
3649 return;
never executed: return;
0
3650-
3651 case
never executed: case CE_MenuBarItem:
CE_MenuBarItem:
never executed: case CE_MenuBarItem:
0
3652 if (const
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3653 QStyleOptionMenuItem mi(*m);-
3654 QRenderRule subRule = renderRule(w, opt, PseudoElement_Item);-
3655 mi.rect = subRule.contentsRect(opt->rect);-
3656 rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);-
3657 subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);-
3658-
3659 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3660 subRule.drawRule(p, opt->rect);-
3661 QCommonStyle::drawControl(ce, &mi, p, w);-
3662 }
never executed: end of block
else {
0
3663 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
&& !(opt->state & QStyle::State_Selected)
!(opt->state &...tate_Selected)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3664-
3665 mi.palette.setColor(QPalette::Window, Qt::transparent);-
3666 mi.palette.setColor(QPalette::Button, Qt::transparent);-
3667 }
never executed: end of block
0
3668 baseStyle()->drawControl(ce, &mi, p, w);-
3669 }
never executed: end of block
0
3670 }-
3671 return;
never executed: return;
0
3672-
3673-
3674 case
never executed: case CE_ComboBoxLabel:
CE_ComboBoxLabel:
never executed: case CE_ComboBoxLabel:
0
3675 if (!rule.hasBox()
!rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3676 break;
never executed: break;
0
3677 if (const
const QStyleOp...mboBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)
const QStyleOp...mboBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3678 QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, w);-
3679 p->save();-
3680 p->setClipRect(editRect);-
3681 if (!cb->currentIcon.isNull()
!cb->currentIcon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3682 int spacing = rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
? rule.box()->spacing : -1;
0
3683 if (spacing == -1
spacing == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3684 spacing = 6;
never executed: spacing = 6;
0
3685 QIcon::Mode mode = cb->state & State_Enabled
cb->state & State_EnabledDescription
TRUEnever evaluated
FALSEnever evaluated
? QIcon::Normal : QIcon::Disabled;
0
3686 QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);-
3687 QRect iconRect(editRect);-
3688 iconRect.setWidth(cb->iconSize.width());-
3689 iconRect = alignedRect(cb->direction,-
3690 Qt::AlignLeft | Qt::AlignVCenter,-
3691 iconRect.size(), editRect);-
3692 drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);-
3693-
3694 if (cb->direction == Qt::RightToLeft
cb->direction ...t::RightToLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3695 editRect.translate(-spacing - cb->iconSize.width(), 0);
never executed: editRect.translate(-spacing - cb->iconSize.width(), 0);
0
3696 else-
3697 editRect.translate(cb->iconSize.width() + spacing, 0);
never executed: editRect.translate(cb->iconSize.width() + spacing, 0);
0
3698 }-
3699 if (!cb->currentText.isEmpty()
!cb->currentText.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !cb->editable
!cb->editableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3700 QPalette styledPalette(cb->palette);-
3701 rule.configurePalette(&styledPalette, QPalette::Text, QPalette::Base);-
3702 drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, styledPalette,-
3703 cb->state & State_Enabled, cb->currentText, QPalette::Text);-
3704 }
never executed: end of block
0
3705 p->restore();-
3706 return;
never executed: return;
0
3707 }-
3708 break;
never executed: break;
0
3709-
3710-
3711 case
never executed: case CE_Header:
CE_Header:
never executed: case CE_Header:
0
3712 if (hasStyleRule(w, PseudoElement_HeaderViewUpArrow)
hasStyleRule(w...erViewUpArrow)Description
TRUEnever evaluated
FALSEnever evaluated
0
3713 || hasStyleRule(w, PseudoElement_HeaderViewDownArrow)
hasStyleRule(w...ViewDownArrow)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3714 ParentStyle::drawControl(ce, opt, p, w);-
3715 return;
never executed: return;
0
3716 }-
3717 if(hasStyleRule(w, PseudoElement_HeaderViewSection)
hasStyleRule(w...erViewSection)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3718 QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);-
3719 if (!subRule.hasNativeBorder()
!subRule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
|| !subRule.baseStyleCanDraw()
!subRule.baseStyleCanDraw()Description
TRUEnever evaluated
FALSEnever evaluated
0
3720 || subRule.hasBackground()
subRule.hasBackground()Description
TRUEnever evaluated
FALSEnever evaluated
|| subRule.hasPalette()
subRule.hasPalette()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3721 ParentStyle::drawControl(ce, opt, p, w);-
3722 return;
never executed: return;
0
3723 }-
3724 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3725 const QFont oldFont = p->font();-
3726 p->setFont(subRule.font.resolve(p->font()));-
3727 baseStyle()->drawControl(ce, opt, p, w);-
3728 p->setFont(oldFont);-
3729 return;
never executed: return;
0
3730 }-
3731 }
never executed: end of block
0
3732 break;
never executed: break;
0
3733 case
never executed: case CE_HeaderSection:
CE_HeaderSection:
never executed: case CE_HeaderSection:
0
3734 if (const
const QStyleOp...Header *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)
const QStyleOp...Header *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3735 QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);-
3736 if (subRule.hasNativeBorder()
subRule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3737 QStyleOptionHeader hdr(*header);-
3738 subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button);-
3739-
3740 if (subRule.baseStyleCanDraw()
subRule.baseStyleCanDraw()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3741 baseStyle()->drawControl(CE_HeaderSection, &hdr, p, w);-
3742 }
never executed: end of block
else {
0
3743 QWindowsStyle::drawControl(CE_HeaderSection, &hdr, p, w);-
3744 }
never executed: end of block
0
3745 } else {-
3746 subRule.drawRule(p, opt->rect);-
3747 }
never executed: end of block
0
3748 return;
never executed: return;
0
3749 }-
3750 break;
never executed: break;
0
3751-
3752 case
never executed: case CE_HeaderLabel:
CE_HeaderLabel:
never executed: case CE_HeaderLabel:
0
3753 if (const
const QStyleOp...Header *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)
const QStyleOp...Header *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3754 QStyleOptionHeader hdr(*header);-
3755 QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);-
3756 subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button);-
3757 QFont oldFont = p->font();-
3758 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3759 p->setFont(subRule.font.resolve(p->font()));
never executed: p->setFont(subRule.font.resolve(p->font()));
0
3760 baseStyle()->drawControl(ce, &hdr, p, w);-
3761 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3762 p->setFont(oldFont);
never executed: p->setFont(oldFont);
0
3763 return;
never executed: return;
0
3764 }-
3765 break;
never executed: break;
0
3766-
3767 case
never executed: case CE_HeaderEmptyArea:
CE_HeaderEmptyArea:
never executed: case CE_HeaderEmptyArea:
0
3768 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3769 return;
never executed: return;
0
3770 }-
3771 break;
never executed: break;
0
3772-
3773 case
never executed: case CE_ProgressBar:
CE_ProgressBar:
never executed: case CE_ProgressBar:
0
3774 QWindowsStyle::drawControl(ce, opt, p, w);-
3775 return;
never executed: return;
0
3776-
3777 case
never executed: case CE_ProgressBarGroove:
CE_ProgressBarGroove:
never executed: case CE_ProgressBarGroove:
0
3778 if (!rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3779 rule.drawRule(p, rule.boxRect(opt->rect, Margin));-
3780 return;
never executed: return;
0
3781 }-
3782 break;
never executed: break;
0
3783-
3784 case
never executed: case CE_ProgressBarContents:
CE_ProgressBarContents:
never executed: case CE_ProgressBarContents:
{
0
3785 QRenderRule subRule = renderRule(w, opt, PseudoElement_ProgressBarChunk);-
3786 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3787 if (const
const QStyleOp...essBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)
const QStyleOp...essBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3788 p->save();-
3789 p->setClipRect(pb->rect);-
3790-
3791 qint64 minimum = qint64(pb->minimum);-
3792 qint64 maximum = qint64(pb->maximum);-
3793 qint64 progress = qint64(pb->progress);-
3794 bool vertical = (pb->orientation == Qt::Vertical);-
3795 bool inverted = pb->invertedAppearance;-
3796-
3797 QTransform m;-
3798 QRect rect = pb->rect;-
3799 if (vertical
verticalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3800 rect = QRect(rect.y(), rect.x(), rect.height(), rect.width());-
3801 m.rotate(90);-
3802 m.translate(0, -(rect.height() + rect.y()*2));-
3803 }
never executed: end of block
0
3804-
3805 bool reverse = ((!vertical
!verticalDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(pb->direction...::RightToLeft)Description
TRUEnever evaluated
FALSEnever evaluated
pb->direction == Qt::RightToLeft)
(pb->direction...::RightToLeft)Description
TRUEnever evaluated
FALSEnever evaluated
) || vertical
verticalDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
3806 if (inverted
invertedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3807 reverse = !reverse;
never executed: reverse = !reverse;
0
3808 const bool indeterminate = pb->minimum == pb->maximum;-
3809 qreal fillRatio = indeterminate
indeterminateDescription
TRUEnever evaluated
FALSEnever evaluated
? 0.50 : qreal(progress - minimum)/(maximum - minimum);
0
3810 int fillWidth = int(rect.width() * fillRatio);-
3811 int chunkWidth = fillWidth;-
3812 if (subRule.hasContentsSize()
subRule.hasContentsSize()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3813 QSize sz = subRule.size();-
3814 chunkWidth = (
(opt->state & ...te_Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
opt->state & QStyle::State_Horizontal)
(opt->state & ...te_Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
? sz.width() : sz.height();
0
3815 }
never executed: end of block
0
3816-
3817 QRect r = rect;-
3818 const QWindowsStylePrivate * const d = d_func();-
3819 if (pb->minimum == 0
pb->minimum == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& pb->maximum == 0
pb->maximum == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3820 int chunkCount = fillWidth/chunkWidth;-
3821 int offset = 0;-
3822 if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject))
QProgressStyle...>styleObject))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3823 offset = animation->animationStep() * 8 % rect.width();
never executed: offset = animation->animationStep() * 8 % rect.width();
0
3824 else-
3825 d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
never executed: d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
0
3826 int x = reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? r.left() + r.width() - offset - chunkWidth : r.x() + offset;
0
3827 while (chunkCount > 0
chunkCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3828 r.setRect(x, rect.y(), chunkWidth, rect.height());-
3829 r = m.mapRect(QRectF(r)).toRect();-
3830 subRule.drawRule(p, r);-
3831 x += reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? -chunkWidth : chunkWidth;
0
3832 if (reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? x < rect.left() : x > rect.right()
reverse ? x < ...> rect.right()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3833 break;
never executed: break;
0
3834 --chunkCount;-
3835 }
never executed: end of block
0
3836-
3837 r = rect;-
3838 x = reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? r.right() - (r.left() - x - chunkWidth)
0
3839 : r.left() + (x - r.right() - chunkWidth);-
3840 while (chunkCount > 0
chunkCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3841 r.setRect(x, rect.y(), chunkWidth, rect.height());-
3842 r = m.mapRect(QRectF(r)).toRect();-
3843 subRule.drawRule(p, r);-
3844 x += reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? -chunkWidth : chunkWidth;
0
3845 --chunkCount;-
3846 }
never executed: end of block
;
0
3847 }
never executed: end of block
else {
0
3848 int x = reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? r.left() + r.width() - chunkWidth : r.x();
0
3849-
3850 for (int i = 0; i < ((int)(qreal(fillWidth)/chunkWidth) + ((qreal(fillWidth)/chunkWidth) > 0 && (qreal(fillWidth)/chunkWidth) != (int)(qreal(fillWidth)/chunkWidth)))
i < ((int)(qre.../chunkWidth)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
3851 r.setRect(x, rect.y(), chunkWidth, rect.height());-
3852 r = m.mapRect(QRectF(r)).toRect();-
3853 subRule.drawRule(p, r);-
3854 x += reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
? -chunkWidth : chunkWidth;
0
3855 }
never executed: end of block
0
3856-
3857 d->stopAnimation(opt->styleObject);-
3858 }
never executed: end of block
0
3859-
3860 p->restore();-
3861 return;
never executed: return;
0
3862 }-
3863 }
never executed: end of block
0
3864 }-
3865 break;
never executed: break;
0
3866-
3867 case
never executed: case CE_ProgressBarLabel:
CE_ProgressBarLabel:
never executed: case CE_ProgressBarLabel:
0
3868 if (const
const QStyleOp...essBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)
const QStyleOp...essBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3869 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| rule.hasBorder()
rule.hasBorder()Description
TRUEnever evaluated
FALSEnever evaluated
|| hasStyleRule(w, PseudoElement_ProgressBarChunk)
hasStyleRule(w...gressBarChunk)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3870 drawItemText(p, pb->rect, pb->textAlignment | Qt::TextSingleLine, pb->palette,-
3871 pb->state & State_Enabled, pb->text, QPalette::Text);-
3872 }
never executed: end of block
else {
0
3873 QStyleOptionProgressBar pbCopy(*pb);-
3874 rule.configurePalette(&pbCopy.palette, QPalette::HighlightedText, QPalette::Highlight);-
3875 baseStyle()->drawControl(ce, &pbCopy, p, w);-
3876 }
never executed: end of block
0
3877 return;
never executed: return;
0
3878 }-
3879 break;
never executed: break;
0
3880-
3881 case
never executed: case CE_SizeGrip:
CE_SizeGrip:
never executed: case CE_SizeGrip:
0
3882 if (const
const QStyleOp...zeGrip *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionSizeGrip *sgOpt = qstyleoption_cast<const QStyleOptionSizeGrip *>(opt)
const QStyleOp...zeGrip *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3883 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3884 rule.drawFrame(p, opt->rect);-
3885 p->save();-
3886 switch (sgOpt->corner) {-
3887 case
never executed: case Qt::BottomRightCorner:
Qt::BottomRightCorner:
never executed: case Qt::BottomRightCorner:
break;
never executed: break;
0
3888 case
never executed: case Qt::BottomLeftCorner:
Qt::BottomLeftCorner:
never executed: case Qt::BottomLeftCorner:
p->rotate(90); break;
never executed: break;
0
3889 case
never executed: case Qt::TopLeftCorner:
Qt::TopLeftCorner:
never executed: case Qt::TopLeftCorner:
p->rotate(180); break;
never executed: break;
0
3890 case
never executed: case Qt::TopRightCorner:
Qt::TopRightCorner:
never executed: case Qt::TopRightCorner:
p->rotate(270); break;
never executed: break;
0
3891 default
never executed: default:
:
never executed: default:
break;
never executed: break;
0
3892 }-
3893 rule.drawImage(p, opt->rect);-
3894 p->restore();-
3895 }
never executed: end of block
else {
0
3896 QStyleOptionSizeGrip sg(*sgOpt);-
3897 sg.rect = rule.contentsRect(opt->rect);-
3898 baseStyle()->drawControl(CE_SizeGrip, &sg, p, w);-
3899 }
never executed: end of block
0
3900 return;
never executed: return;
0
3901 }-
3902 break;
never executed: break;
0
3903-
3904 case
never executed: case CE_ToolBoxTab:
CE_ToolBoxTab:
never executed: case CE_ToolBoxTab:
0
3905 QWindowsStyle::drawControl(ce, opt, p, w);-
3906 return;
never executed: return;
0
3907-
3908 case
never executed: case CE_ToolBoxTabShape:
CE_ToolBoxTabShape:
never executed: case CE_ToolBoxTabShape:
{
0
3909 QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolBoxTab);-
3910 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3911 subRule.drawRule(p, opt->rect);-
3912 return;
never executed: return;
0
3913 }-
3914 }-
3915 break;
never executed: break;
0
3916-
3917 case
never executed: case CE_ToolBoxTabLabel:
CE_ToolBoxTabLabel:
never executed: case CE_ToolBoxTabLabel:
0
3918 if (const
const QStyleOp...oolBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionToolBox *box = qstyleoption_cast<const QStyleOptionToolBox *>(opt)
const QStyleOp...oolBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3919 QStyleOptionToolBox boxCopy(*box);-
3920 QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolBoxTab);-
3921 subRule.configurePalette(&boxCopy.palette, QPalette::ButtonText, QPalette::Button);-
3922 QFont oldFont = p->font();-
3923 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3924 p->setFont(subRule.font);
never executed: p->setFont(subRule.font);
0
3925 boxCopy.rect = subRule.contentsRect(opt->rect);-
3926 QWindowsStyle::drawControl(ce, &boxCopy, p , w);-
3927 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3928 p->setFont(oldFont);
never executed: p->setFont(oldFont);
0
3929 return;
never executed: return;
0
3930 }-
3931 break;
never executed: break;
0
3932-
3933 case
never executed: case CE_ScrollBarAddPage:
CE_ScrollBarAddPage:
never executed: case CE_ScrollBarAddPage:
0
3934 pe1 = PseudoElement_ScrollBarAddPage;-
3935 break;
never executed: break;
0
3936-
3937 case
never executed: case CE_ScrollBarSubPage:
CE_ScrollBarSubPage:
never executed: case CE_ScrollBarSubPage:
0
3938 pe1 = PseudoElement_ScrollBarSubPage;-
3939 break;
never executed: break;
0
3940-
3941 case
never executed: case CE_ScrollBarAddLine:
CE_ScrollBarAddLine:
never executed: case CE_ScrollBarAddLine:
0
3942 pe1 = PseudoElement_ScrollBarAddLine;-
3943 pe2 = (
(opt->state & ...te_Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
opt->state & QStyle::State_Horizontal)
(opt->state & ...te_Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
? PseudoElement_ScrollBarRightArrow : PseudoElement_ScrollBarDownArrow;
0
3944 fallback = true;-
3945 break;
never executed: break;
0
3946-
3947 case
never executed: case CE_ScrollBarSubLine:
CE_ScrollBarSubLine:
never executed: case CE_ScrollBarSubLine:
0
3948 pe1 = PseudoElement_ScrollBarSubLine;-
3949 pe2 = (
(opt->state & ...te_Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
opt->state & QStyle::State_Horizontal)
(opt->state & ...te_Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
? PseudoElement_ScrollBarLeftArrow : PseudoElement_ScrollBarUpArrow;
0
3950 fallback = true;-
3951 break;
never executed: break;
0
3952-
3953 case
never executed: case CE_ScrollBarFirst:
CE_ScrollBarFirst:
never executed: case CE_ScrollBarFirst:
0
3954 pe1 = PseudoElement_ScrollBarFirst;-
3955 break;
never executed: break;
0
3956-
3957 case
never executed: case CE_ScrollBarLast:
CE_ScrollBarLast:
never executed: case CE_ScrollBarLast:
0
3958 pe1 = PseudoElement_ScrollBarLast;-
3959 break;
never executed: break;
0
3960-
3961 case
never executed: case CE_ScrollBarSlider:
CE_ScrollBarSlider:
never executed: case CE_ScrollBarSlider:
0
3962 pe1 = PseudoElement_ScrollBarSlider;-
3963 fallback = true;-
3964 break;
never executed: break;
0
3965-
3966-
3967 case
never executed: case CE_ItemViewItem:
CE_ItemViewItem:
never executed: case CE_ItemViewItem:
0
3968 if (const
const QStyleOp...ewItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)
const QStyleOp...ewItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3969 QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);-
3970 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
|| hasStyleRule(w, PseudoElement_Indicator)
hasStyleRule(w...ent_Indicator)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3971 QStyleOptionViewItem optCopy(*vopt);-
3972 subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text,-
3973 vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base);-
3974 QWindowsStyle::drawControl(ce, &optCopy, p, w);-
3975 }
never executed: end of block
else {
0
3976 QStyleOptionViewItem voptCopy(*vopt);-
3977 subRule.configurePalette(&voptCopy.palette, QPalette::Text, QPalette::NoRole);-
3978 baseStyle()->drawControl(ce, &voptCopy, p, w);-
3979 }
never executed: end of block
0
3980 return;
never executed: return;
0
3981 }-
3982 break;
never executed: break;
0
3983-
3984-
3985-
3986 case
never executed: case CE_TabBarTab:
CE_TabBarTab:
never executed: case CE_TabBarTab:
0
3987 if (hasStyleRule(w, PseudoElement_TabBarTab)
hasStyleRule(w...ent_TabBarTab)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3988 QWindowsStyle::drawControl(ce, opt, p, w);-
3989 return;
never executed: return;
0
3990 }-
3991 break;
never executed: break;
0
3992-
3993 case
never executed: case CE_TabBarTabLabel:
CE_TabBarTabLabel:
never executed: case CE_TabBarTabLabel:
0
3994 case
never executed: case CE_TabBarTabShape:
CE_TabBarTabShape:
never executed: case CE_TabBarTabShape:
0
3995 if (const
const QStyleOp...ionTab *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)
const QStyleOp...ionTab *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3996 QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);-
3997 QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, opt->rect, opt->direction);-
3998 if (ce == CE_TabBarTabShape
ce == CE_TabBarTabShapeDescription
TRUEnever evaluated
FALSEnever evaluated
&& subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3999 subRule.drawRule(p, r);-
4000 return;
never executed: return;
0
4001 }-
4002 QStyleOptionTab tabCopy(*tab);-
4003 subRule.configurePalette(&tabCopy.palette, QPalette::WindowText, QPalette::Window);-
4004 QFont oldFont = p->font();-
4005 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4006 p->setFont(subRule.font);
never executed: p->setFont(subRule.font);
0
4007 if (subRule.hasBox()
subRule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| !subRule.hasNativeBorder()
!subRule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4008 tabCopy.rect = ce == CE_TabBarTabShape
ce == CE_TabBarTabShapeDescription
TRUEnever evaluated
FALSEnever evaluated
? subRule.borderRect(r)
0
4009 : subRule.contentsRect(r);-
4010 QWindowsStyle::drawControl(ce, &tabCopy, p, w);-
4011 }
never executed: end of block
else {
0
4012 baseStyle()->drawControl(ce, &tabCopy, p, w);-
4013 }
never executed: end of block
0
4014 if (subRule.hasFont
subRule.hasFontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4015 p->setFont(oldFont);
never executed: p->setFont(oldFont);
0
4016-
4017 return;
never executed: return;
0
4018 }-
4019 break;
never executed: break;
0
4020-
4021-
4022 case
never executed: case CE_ColumnViewGrip:
CE_ColumnViewGrip:
never executed: case CE_ColumnViewGrip:
0
4023 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4024 rule.drawRule(p, opt->rect);-
4025 return;
never executed: return;
0
4026 }-
4027 break;
never executed: break;
0
4028-
4029 case
never executed: case CE_DockWidgetTitle:
CE_DockWidgetTitle:
never executed: case CE_DockWidgetTitle:
0
4030 if (const
const QStyleOp...Widget *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)
const QStyleOp...Widget *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4031 QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetTitle);-
4032 if (!subRule.hasDrawable()
!subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
&& !subRule.hasPosition()
!subRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
4033 break;
never executed: break;
0
4034 if (subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4035 subRule.drawRule(p, opt->rect);-
4036 }
never executed: end of block
else {
0
4037 QStyleOptionDockWidget dwCopy(*dwOpt);-
4038 dwCopy.title = QString();-
4039 baseStyle()->drawControl(ce, &dwCopy, p, w);-
4040 }
never executed: end of block
0
4041-
4042 if (!dwOpt->title.isEmpty()
!dwOpt->title.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4043 QRect r = subElementRect(SE_DockWidgetTitleBarText, opt, w);-
4044 if (dwOpt->verticalTitleBar
dwOpt->verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
4045 r .setSize(= r.size().transposed());();-
4046 p->save();-
4047 p->translate(r.left(), r.top() + r.width());-
4048 p->rotate(-90);-
4049 p->translate(-r.left(), -r.top());-
4050 }
never executed: end of block
0
4051 r = subRule.contentsRect(r);-
4052-
4053 Qt::Alignment alignment = 0;-
4054 if (subRule.hasPosition()
subRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
4055 alignment = subRule.position()->textAlignment;
never executed: alignment = subRule.position()->textAlignment;
0
4056 if (alignment == 0
alignment == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
4057 alignment = Qt::AlignLeft;
never executed: alignment = Qt::AlignLeft;
0
4058-
4059 QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, r.width());-
4060 drawItemText(p, r,-
4061 alignment | Qt::TextShowMnemonic, dwOpt->palette,-
4062 dwOpt->state & State_Enabled, titleText,-
4063 QPalette::WindowText);-
4064-
4065 if (dwOpt->verticalTitleBar
dwOpt->verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
4066 p->restore();
never executed: p->restore();
0
4067 }
never executed: end of block
0
4068-
4069 return;
never executed: return;
0
4070 }-
4071 break;
never executed: break;
0
4072 case
never executed: case CE_ShapedFrame:
CE_ShapedFrame:
never executed: case CE_ShapedFrame:
0
4073 if (const
const QStyleOp...nFrame *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)
const QStyleOp...nFrame *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4074 if (rule.hasNativeBorder()
rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4075 QStyleOptionFrame frmOpt(*frm);-
4076 rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);-
4077 frmOpt.rect = rule.borderRect(frmOpt.rect);-
4078 baseStyle()->drawControl(ce, &frmOpt, p, w);-
4079 }
never executed: end of block
0
4080-
4081 }
never executed: end of block
0
4082 return;
never executed: return;
0
4083-
4084-
4085 default
never executed: default:
:
never executed: default:
0
4086 break;
never executed: break;
0
4087 }-
4088-
4089 if (pe1 != PseudoElement_None
pe1 != PseudoElement_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
4090 QRenderRule subRule = renderRule(w, opt, pe1);-
4091 if (subRule.bg != 0
subRule.bg != 0Description
TRUEnever evaluated
FALSEnever evaluated
|| subRule.hasDrawable()
subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
4092-
4093-
4094 subRule.drawRule(p, opt->rect);-
4095 }
never executed: end of block
else if (fallback
fallbackDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
4096 QWindowsStyle::drawControl(ce, opt, p, w);-
4097 pe2 = PseudoElement_None;-
4098 }
never executed: end of block
else {
0
4099 baseStyle()->drawControl(ce, opt, p, w);-
4100 }
never executed: end of block
0
4101 if (pe2 != PseudoElement_None
pe2 != PseudoElement_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
4102 QRenderRule subSubRule = renderRule(w, opt, pe2);-
4103 QRect r = positionRect(w, subRule, subSubRule, pe2, opt->rect, opt->direction);-
4104 subSubRule.drawRule(p, r);-
4105 }
never executed: end of block
0
4106 return;
never executed: return;
0
4107 }-
4108-
4109 baseStyle()->drawControl(ce, opt, p, w);-
4110}
never executed: end of block
0
4111-
4112void QStyleSheetStyle::drawItemPixmap(QPainter *p, const QRect &rect, int alignment, const-
4113 QPixmap &pixmap) const-
4114{-
4115 baseStyle()->drawItemPixmap(p, rect, alignment, pixmap);-
4116}-
4117-
4118void QStyleSheetStyle::drawItemText(QPainter *painter, const QRect& rect, int alignment, const QPalette &pal,-
4119 bool enabled, const QString& text, QPalette::ColorRole textRole) const-
4120{-
4121 baseStyle()->drawItemText(painter, rect, alignment, pal, enabled, text, textRole);-
4122}-
4123-
4124void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,-
4125 const QWidget *w) const-
4126{-
4127 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { baseStyle()->drawPrimitive(pe, opt, p, w); return; } QStyleSheetStyleRecursionGuard recursion_guard(this);-
4128-
4129 int pseudoElement = PseudoElement_None;-
4130 QRenderRule rule = renderRule(w, opt);-
4131 QRect rect = opt->rect;-
4132-
4133 switch (pe) {-
4134-
4135 case PE_FrameStatusBar: {-
4136 QRenderRule subRule = renderRule(w ? w->parentWidget() : nullptr, opt, PseudoElement_Item);-
4137 if (subRule.hasDrawable()) {-
4138 subRule.drawRule(p, opt->rect);-
4139 return;-
4140 }-
4141 break;-
4142 }-
4143-
4144 case PE_IndicatorArrowDown:-
4145 pseudoElement = PseudoElement_DownArrow;-
4146 break;-
4147-
4148 case PE_IndicatorArrowUp:-
4149 pseudoElement = PseudoElement_UpArrow;-
4150 break;-
4151-
4152 case PE_IndicatorRadioButton:-
4153 pseudoElement = PseudoElement_ExclusiveIndicator;-
4154 break;-
4155-
4156 case PE_IndicatorViewItemCheck:-
4157 pseudoElement = PseudoElement_ViewItemIndicator;-
4158 break;-
4159-
4160 case PE_IndicatorCheckBox:-
4161 pseudoElement = PseudoElement_Indicator;-
4162 break;-
4163-
4164 case PE_IndicatorHeaderArrow:-
4165 if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {-
4166 pseudoElement = hdr->sortIndicator == QStyleOptionHeader::SortUp-
4167 ? PseudoElement_HeaderViewUpArrow-
4168 : PseudoElement_HeaderViewDownArrow;-
4169 }-
4170 break;-
4171-
4172 case PE_PanelButtonTool:-
4173 case PE_PanelButtonCommand:-
4174 if (qobject_cast<const QAbstractButton *>(w) && rule.hasBackground() && rule.hasNativeBorder()) {-
4175-
4176 ParentStyle::drawPrimitive(pe, opt, p, w);-
4177 if (!rule.background()->pixmap.isNull() || rule.hasImage()) {-
4178 rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin).adjusted(1,1,-1,-1));-
4179 }-
4180 return;-
4181 }-
4182 if (!rule.hasNativeBorder()) {-
4183 rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin));-
4184 return;-
4185 }-
4186 break;-
4187-
4188 case PE_IndicatorButtonDropDown: {-
4189 QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu);-
4190 if (!subRule.hasNativeBorder()) {-
4191 rule.drawBorder(p, opt->rect);-
4192 return;-
4193 }-
4194 break;-
4195 }-
4196-
4197 case PE_FrameDefaultButton:-
4198 if (rule.hasNativeBorder()) {-
4199 if (rule.baseStyleCanDraw())-
4200 break;-
4201 QWindowsStyle::drawPrimitive(pe, opt, p, w);-
4202 }-
4203 return;-
4204-
4205 case PE_FrameWindow:-
4206 case PE_FrameDockWidget:-
4207 case PE_Frame:-
4208 if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {-
4209 if (rule.hasNativeBorder()) {-
4210 QStyleOptionFrame frmOpt(*frm);-
4211 rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);-
4212 baseStyle()->drawPrimitive(pe, &frmOpt, p, w);-
4213 } else {-
4214 rule.drawBorder(p, rule.borderRect(opt->rect));-
4215 }-
4216 }-
4217 return;-
4218-
4219 case PE_PanelLineEdit:-
4220 if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {-
4221-
4222 if (w && qobject_cast<const QAbstractSpinBox *>(w->parentWidget())) {-
4223 QRenderRule spinboxRule = renderRule(w->parentWidget(), opt);-
4224 if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw())-
4225 return;-
4226 rule = spinboxRule;-
4227 }-
4228-
4229 if (rule.hasNativeBorder()) {-
4230 QStyleOptionFrame frmOpt(*frm);-
4231 rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);-
4232 frmOpt.rect = rule.borderRect(frmOpt.rect);-
4233 if (rule.baseStyleCanDraw()) {-
4234 rule.drawBackgroundImage(p, opt->rect);-
4235 baseStyle()->drawPrimitive(pe, &frmOpt, p, w);-
4236 } else {-
4237 rule.drawBackground(p, opt->rect);-
4238 if (frmOpt.lineWidth > 0)-
4239 baseStyle()->drawPrimitive(PE_FrameLineEdit, &frmOpt, p, w);-
4240 }-
4241 } else {-
4242 rule.drawRule(p, opt->rect);-
4243 }-
4244 }-
4245 return;-
4246-
4247 case PE_Widget:-
4248 if (w && !rule.hasDrawable()) {-
4249 QWidget *container = containerWidget(w);-
4250 if (styleSheetCaches->autoFillDisabledWidgets.contains(container)-
4251 && (container == w || !renderRule(container, opt).hasBackground())) {-
4252-
4253-
4254 p->fillRect(opt->rect, opt->palette.brush(w->backgroundRole()));-
4255 }-
4256 break;-
4257 }-
4258-
4259 if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {-
4260 const QAbstractScrollAreaPrivate *sap = sa->d_func();-
4261 rule.drawBackground(p, opt->rect, sap->contentsOffset());-
4262 if (rule.hasBorder()) {-
4263 QRect brect = rule.borderRect(opt->rect);-
4264 if (styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, opt, w)) {-
4265 QRect r = brect.adjusted(0, 0, sa->verticalScrollBar()->isVisible() ? -sa->verticalScrollBar()->width() : 0,-
4266 sa->horizontalScrollBar()->isVisible() ? -sa->horizontalScrollBar()->height() : 0);-
4267 brect = QStyle::visualRect(opt->direction, brect, r);-
4268 }-
4269 rule.drawBorder(p, brect);-
4270 }-
4271 break;-
4272 }-
4273-
4274-
4275 case PE_PanelMenu:-
4276 case PE_PanelStatusBar:-
4277 if(rule.hasDrawable()) {-
4278 rule.drawRule(p, opt->rect);-
4279 return;-
4280 }-
4281 break;-
4282-
4283 case PE_FrameMenu:-
4284 if (rule.hasDrawable()) {-
4285-
4286 return;-
4287 }-
4288 break;-
4289-
4290 case PE_PanelMenuBar:-
4291 if (rule.hasDrawable()) {-
4292-
4293 return;-
4294 }-
4295 break;-
4296-
4297 case PE_IndicatorToolBarSeparator:-
4298 case PE_IndicatorToolBarHandle: {-
4299 PseudoElement ps = pe == PE_IndicatorToolBarHandle ? PseudoElement_ToolBarHandle : PseudoElement_ToolBarSeparator;-
4300 QRenderRule subRule = renderRule(w, opt, ps);-
4301 if (subRule.hasDrawable()) {-
4302 subRule.drawRule(p, opt->rect);-
4303 return;-
4304 }-
4305 }-
4306 break;-
4307-
4308 case PE_IndicatorMenuCheckMark:-
4309 pseudoElement = PseudoElement_MenuCheckMark;-
4310 break;-
4311-
4312 case PE_IndicatorArrowLeft:-
4313 pseudoElement = PseudoElement_LeftArrow;-
4314 break;-
4315-
4316 case PE_IndicatorArrowRight:-
4317 pseudoElement = PseudoElement_RightArrow;-
4318 break;-
4319-
4320 case PE_IndicatorColumnViewArrow:-
4321 if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {-
4322 bool reverse = (viewOpt->direction == Qt::RightToLeft);-
4323 pseudoElement = reverse ? PseudoElement_LeftArrow : PseudoElement_RightArrow;-
4324 } else {-
4325 pseudoElement = PseudoElement_RightArrow;-
4326 }-
4327 break;-
4328-
4329 case PE_IndicatorBranch:-
4330 if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {-
4331 QRenderRule subRule = renderRule(w, opt, PseudoElement_TreeViewBranch);-
4332 if (subRule.hasDrawable()) {-
4333 if ((vopt->state & QStyle::State_Selected) && vopt->showDecorationSelected)-
4334 p->fillRect(vopt->rect, vopt->palette.highlight());-
4335 else if (vopt->features & QStyleOptionViewItem::Alternate)-
4336 p->fillRect(vopt->rect, vopt->palette.alternateBase());-
4337 subRule.drawRule(p, opt->rect);-
4338 } else {-
4339 baseStyle()->drawPrimitive(pe, vopt, p, w);-
4340 }-
4341 }-
4342 return;-
4343-
4344 case PE_PanelTipLabel:-
4345 if (!rule.hasDrawable())-
4346 break;-
4347-
4348 if (const QStyleOptionFrame *frmOpt = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {-
4349 if (rule.hasNativeBorder()) {-
4350 rule.drawBackground(p, opt->rect);-
4351 QStyleOptionFrame optCopy(*frmOpt);-
4352 optCopy.rect = rule.borderRect(opt->rect);-
4353 optCopy.palette.setBrush(QPalette::Window, Qt::NoBrush);-
4354 baseStyle()->drawPrimitive(pe, &optCopy, p, w);-
4355 } else {-
4356 rule.drawRule(p, opt->rect);-
4357 }-
4358 }-
4359 return;-
4360-
4361 case PE_FrameGroupBox:-
4362 if (rule.hasNativeBorder())-
4363 break;-
4364 rule.drawBorder(p, opt->rect);-
4365 return;-
4366-
4367-
4368 case PE_FrameTabWidget:-
4369 if (const QStyleOptionTabWidgetFrame *frm = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {-
4370 QRenderRule subRule = renderRule(w, opt, PseudoElement_TabWidgetPane);-
4371 if (subRule.hasNativeBorder()) {-
4372 subRule.drawBackground(p, opt->rect);-
4373 QStyleOptionTabWidgetFrame frmCopy(*frm);-
4374 subRule.configurePalette(&frmCopy.palette, QPalette::WindowText, QPalette::Window);-
4375 baseStyle()->drawPrimitive(pe, &frmCopy, p, w);-
4376 } else {-
4377 subRule.drawRule(p, opt->rect);-
4378 }-
4379 return;-
4380 }-
4381 break;-
4382-
4383-
4384 case PE_IndicatorProgressChunk:-
4385 pseudoElement = PseudoElement_ProgressBarChunk;-
4386 break;-
4387-
4388 case PE_IndicatorTabTear:-
4389 pseudoElement = PseudoElement_TabBarTear;-
4390 break;-
4391-
4392 case PE_FrameFocusRect:-
4393 if (!rule.hasNativeOutline()) {-
4394 rule.drawOutline(p, opt->rect);-
4395 return;-
4396 }-
4397 break;-
4398-
4399 case PE_IndicatorDockWidgetResizeHandle:-
4400 pseudoElement = PseudoElement_DockWidgetSeparator;-
4401 break;-
4402-
4403 case PE_PanelItemViewItem:-
4404 pseudoElement = PseudoElement_ViewItem;-
4405 break;-
4406-
4407 case PE_PanelScrollAreaCorner:-
4408 pseudoElement = PseudoElement_ScrollAreaCorner;-
4409 break;-
4410-
4411 case PE_IndicatorSpinDown:-
4412 case PE_IndicatorSpinMinus:-
4413 pseudoElement = PseudoElement_SpinBoxDownArrow;-
4414 break;-
4415-
4416 case PE_IndicatorSpinUp:-
4417 case PE_IndicatorSpinPlus:-
4418 pseudoElement = PseudoElement_SpinBoxUpArrow;-
4419 break;-
4420-
4421 case PE_IndicatorTabClose:-
4422 if (w)-
4423 w = w->parentWidget();-
4424 pseudoElement = PseudoElement_TabBarTabCloseButton;-
4425-
4426-
4427 default:-
4428 break;-
4429 }-
4430-
4431 if (pseudoElement != PseudoElement_None) {-
4432 QRenderRule subRule = renderRule(w, opt, pseudoElement);-
4433 if (subRule.hasDrawable()) {-
4434 subRule.drawRule(p, rect);-
4435 } else {-
4436 baseStyle()->drawPrimitive(pe, opt, p, w);-
4437 }-
4438 } else {-
4439 baseStyle()->drawPrimitive(pe, opt, p, w);-
4440 }-
4441}-
4442-
4443QPixmap QStyleSheetStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap,-
4444 const QStyleOption *option) const-
4445{-
4446 return baseStyle()->generatedIconPixmap(iconMode, pixmap, option);-
4447}-
4448-
4449QStyle::SubControl QStyleSheetStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,-
4450 const QPoint &pt, const QWidget *w) const-
4451{-
4452 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->hitTestComplexControl(cc, opt, pt, w); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
4453 switch (cc) {-
4454 case CC_TitleBar:-
4455 if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {-
4456 QRenderRule rule = renderRule(w, opt, PseudoElement_TitleBar);-
4457 if (rule.hasDrawable() || rule.hasBox() || rule.hasBorder()) {-
4458 QHash<QStyle::SubControl, QRect> layout = titleBarLayout(w, tb);-
4459 QRect r;-
4460 QStyle::SubControl sc = QStyle::SC_None;-
4461 uint ctrl = SC_TitleBarSysMenu;-
4462 while (ctrl <= SC_TitleBarLabel) {-
4463 r = layout[QStyle::SubControl(ctrl)];-
4464 if (r.isValid() && r.contains(pt)) {-
4465 sc = QStyle::SubControl(ctrl);-
4466 break;-
4467 }-
4468 ctrl <<= 1;-
4469 }-
4470 return sc;-
4471 }-
4472 }-
4473 break;-
4474-
4475 case CC_MdiControls:-
4476 if (hasStyleRule(w, PseudoElement_MdiCloseButton)-
4477 || hasStyleRule(w, PseudoElement_MdiNormalButton)-
4478 || hasStyleRule(w, PseudoElement_MdiMinButton))-
4479 return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w);-
4480 break;-
4481-
4482 case CC_ScrollBar: {-
4483 QRenderRule rule = renderRule(w, opt);-
4484 if (!rule.hasDrawable() && !rule.hasBox())-
4485 break;-
4486 }-
4487-
4488 case CC_SpinBox:-
4489 case CC_GroupBox:-
4490 case CC_ComboBox:-
4491 case CC_Slider:-
4492 case CC_ToolButton:-
4493 return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w);-
4494 default:-
4495 break;-
4496 }-
4497-
4498 return baseStyle()->hitTestComplexControl(cc, opt, pt, w);-
4499}-
4500-
4501QRect QStyleSheetStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const-
4502{-
4503 return baseStyle()->itemPixmapRect(rect, alignment, pixmap);-
4504}-
4505-
4506QRect QStyleSheetStyle::itemTextRect(const QFontMetrics &metrics, const QRect& rect, int alignment,-
4507 bool enabled, const QString& text) const-
4508{-
4509 return baseStyle()->itemTextRect(metrics, rect, alignment, enabled, text);-
4510}-
4511-
4512int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWidget *w) const-
4513{-
4514 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->pixelMetric(m, opt, w); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
4515-
4516 QRenderRule rule = renderRule(w, opt);-
4517 QRenderRule subRule;-
4518-
4519 switch (m) {-
4520 case PM_MenuButtonIndicator:-
4521-
4522-
4523 if (qobject_cast<const QToolButton *>(w) && (rule.hasBox() || !rule.hasNativeBorder()))-
4524 return 0;-
4525-
4526 subRule = renderRule(w, opt, PseudoElement_PushButtonMenuIndicator);-
4527 if (subRule.hasContentsSize())-
4528 return subRule.size().width();-
4529 break;-
4530-
4531 case PM_ButtonShiftHorizontal:-
4532 case PM_ButtonShiftVertical:-
4533 case PM_ButtonMargin:-
4534 case PM_ButtonDefaultIndicator:-
4535 if (rule.hasBox())-
4536 return 0;-
4537 break;-
4538-
4539 case PM_DefaultFrameWidth:-
4540 if (!rule.hasNativeBorder())-
4541 return rule.border()->borders[LeftEdge];-
4542 break;-
4543-
4544 case PM_ExclusiveIndicatorWidth:-
4545 case PM_IndicatorWidth:-
4546 case PM_ExclusiveIndicatorHeight:-
4547 case PM_IndicatorHeight:-
4548 subRule = renderRule(w, opt, PseudoElement_Indicator);-
4549 if (subRule.hasContentsSize()) {-
4550 return (m == PM_ExclusiveIndicatorWidth) || (m == PM_IndicatorWidth)-
4551 ? subRule.size().width() : subRule.size().height();-
4552 }-
4553 break;-
4554-
4555 case PM_DockWidgetFrameWidth:-
4556 case PM_ToolTipLabelFrameWidth:-
4557 if (!rule.hasDrawable())-
4558 break;-
4559-
4560 return (rule.border() ? rule.border()->borders[LeftEdge] : 0)-
4561 + (rule.hasBox() ? rule.box()->margins[LeftEdge] + rule.box()->paddings[LeftEdge]: 0);-
4562-
4563 case PM_ToolBarFrameWidth:-
4564 if (rule.hasBorder() || rule.hasBox())-
4565 return (rule.border() ? rule.border()->borders[LeftEdge] : 0)-
4566 + (rule.hasBox() ? rule.box()->paddings[LeftEdge]: 0);-
4567 break;-
4568-
4569 case PM_MenuPanelWidth:-
4570 case PM_MenuBarPanelWidth:-
4571 if (rule.hasBorder() || rule.hasBox())-
4572 return (rule.border() ? rule.border()->borders[LeftEdge] : 0)-
4573 + (rule.hasBox() ? rule.box()->margins[LeftEdge]: 0);-
4574 break;-
4575-
4576-
4577 case PM_MenuHMargin:-
4578 case PM_MenuBarHMargin:-
4579 if (rule.hasBox())-
4580 return rule.box()->paddings[LeftEdge];-
4581 break;-
4582-
4583 case PM_MenuVMargin:-
4584 case PM_MenuBarVMargin:-
4585 if (rule.hasBox())-
4586 return rule.box()->paddings[TopEdge];-
4587 break;-
4588-
4589 case PM_DockWidgetTitleBarButtonMargin:-
4590 case PM_ToolBarItemMargin:-
4591 if (rule.hasBox())-
4592 return rule.box()->margins[TopEdge];-
4593 break;-
4594-
4595 case PM_ToolBarItemSpacing:-
4596 case PM_MenuBarItemSpacing:-
4597 if (rule.hasBox() && rule.box()->spacing != -1)-
4598 return rule.box()->spacing;-
4599 break;-
4600-
4601 case PM_MenuTearoffHeight:-
4602 case PM_MenuScrollerHeight: {-
4603 PseudoElement ps = m == PM_MenuTearoffHeight ? PseudoElement_MenuTearoff : PseudoElement_MenuScroller;-
4604 subRule = renderRule(w, opt, ps);-
4605 if (subRule.hasContentsSize())-
4606 return subRule.size().height();-
4607 break;-
4608 }-
4609-
4610 case PM_ToolBarExtensionExtent:-
4611 break;-
4612-
4613 case PM_SplitterWidth:-
4614 case PM_ToolBarSeparatorExtent:-
4615 case PM_ToolBarHandleExtent: {-
4616 PseudoElement ps;-
4617 if (m == PM_ToolBarHandleExtent) ps = PseudoElement_ToolBarHandle;-
4618 else if (m == PM_SplitterWidth) ps = PseudoElement_SplitterHandle;-
4619 else ps = PseudoElement_ToolBarSeparator;-
4620 subRule = renderRule(w, opt, ps);-
4621 if (subRule.hasContentsSize()) {-
4622 QSize sz = subRule.size();-
4623 return (opt && opt->state & QStyle::State_Horizontal) ? sz.width() : sz.height();-
4624 }-
4625 break;-
4626 }-
4627-
4628 case PM_RadioButtonLabelSpacing:-
4629 if (rule.hasBox() && rule.box()->spacing != -1)-
4630 return rule.box()->spacing;-
4631 break;-
4632 case PM_CheckBoxLabelSpacing:-
4633 if (qobject_cast<const QCheckBox *>(w)) {-
4634 if (rule.hasBox() && rule.box()->spacing != -1)-
4635 return rule.box()->spacing;-
4636 }-
4637-
4638 subRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);-
4639 if (subRule.hasBox() && subRule.box()->spacing != -1)-
4640 return subRule.box()->spacing;-
4641 break;-
4642-
4643-
4644 case PM_ScrollBarExtent:-
4645 if (rule.hasContentsSize()) {-
4646 QSize sz = rule.size();-
4647 if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt))-
4648 return sb->orientation == Qt::Horizontal ? sz.height() : sz.width();-
4649 return sz.width() == -1 ? sz.height() : sz.width();-
4650 }-
4651 break;-
4652-
4653 case PM_ScrollBarSliderMin:-
4654 if (hasStyleRule(w, PseudoElement_ScrollBarSlider)) {-
4655 subRule = renderRule(w, opt, PseudoElement_ScrollBarSlider);-
4656 QSize msz = subRule.minimumSize();-
4657 if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt))-
4658 return sb->orientation == Qt::Horizontal ? msz.width() : msz.height();-
4659 return msz.width() == -1 ? msz.height() : msz.width();-
4660 }-
4661 break;-
4662-
4663 case PM_ScrollView_ScrollBarSpacing:-
4664 if(!rule.hasNativeBorder() || rule.hasBox())-
4665 return 0;-
4666 break;-
4667-
4668-
4669 case PM_ProgressBarChunkWidth:-
4670 subRule = renderRule(w, opt, PseudoElement_ProgressBarChunk);-
4671 if (subRule.hasContentsSize()) {-
4672 QSize sz = subRule.size();-
4673 return (opt->state & QStyle::State_Horizontal)-
4674 ? sz.width() : sz.height();-
4675 }-
4676 break;-
4677-
4678-
4679 case PM_TabBarTabHSpace:-
4680 case PM_TabBarTabVSpace:-
4681 subRule = renderRule(w, opt, PseudoElement_TabBarTab);-
4682 if (subRule.hasBox() || subRule.hasBorder())-
4683 return 0;-
4684 break;-
4685-
4686 case PM_TabBarScrollButtonWidth: {-
4687 subRule = renderRule(w, opt, PseudoElement_TabBarScroller);-
4688 if (subRule.hasContentsSize()) {-
4689 QSize sz = subRule.size();-
4690 return sz.width() != -1 ? sz.width() : sz.height();-
4691 }-
4692 }-
4693 break;-
4694-
4695 case PM_TabBarTabShiftHorizontal:-
4696 case PM_TabBarTabShiftVertical:-
4697 subRule = renderRule(w, opt, PseudoElement_TabBarTab);-
4698 if (subRule.hasBox())-
4699 return 0;-
4700 break;-
4701-
4702 case PM_TabBarBaseOverlap: {-
4703 const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w);-
4704 if (!tabWidget && w)-
4705 tabWidget = w->parentWidget();-
4706 if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) {-
4707 return 0;-
4708 }-
4709 break;-
4710 }-
4711-
4712-
4713 case PM_SliderThickness:-
4714 case PM_SliderLength:-
4715 if (rule.hasContentsSize()) {-
4716 bool horizontal = opt->state & QStyle::State_Horizontal;-
4717 if (m == PM_SliderThickness) {-
4718 QSize sz = rule.size();-
4719 return horizontal ? sz.height() : sz.width();-
4720 } else {-
4721 QSize msz = rule.minimumContentsSize();-
4722 return horizontal ? msz.width() : msz.height();-
4723 }-
4724 }-
4725 break;-
4726-
4727 case PM_SliderControlThickness: {-
4728 QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle);-
4729 if (!subRule.hasContentsSize())-
4730 break;-
4731 QSize size = subRule.size();-
4732 return (opt->state & QStyle::State_Horizontal) ? size.height() : size.width();-
4733 }-
4734-
4735 case PM_ToolBarIconSize:-
4736 case PM_ListViewIconSize:-
4737 case PM_IconViewIconSize:-
4738 case PM_TabBarIconSize:-
4739 case PM_MessageBoxIconSize:-
4740 case PM_ButtonIconSize:-
4741 case PM_SmallIconSize:-
4742 if (rule.hasStyleHint(QLatin1String("icon-size"))) {-
4743 return rule.styleHint(QLatin1String("icon-size")).toSize().width();-
4744 }-
4745 break;-
4746-
4747 case PM_DockWidgetTitleMargin: {-
4748 QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetTitle);-
4749 if (!subRule.hasBox())-
4750 break;-
4751 return (subRule.border() ? subRule.border()->borders[TopEdge] : 0)-
4752 + (subRule.hasBox() ? subRule.box()->margins[TopEdge] + subRule.box()->paddings[TopEdge]: 0);-
4753 }-
4754-
4755 case PM_DockWidgetSeparatorExtent: {-
4756 QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetSeparator);-
4757 if (!subRule.hasContentsSize())-
4758 break;-
4759 QSize sz = subRule.size();-
4760 return qMax(sz.width(), sz.height());-
4761 }-
4762-
4763 case PM_TitleBarHeight: {-
4764 QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar);-
4765 if (subRule.hasContentsSize())-
4766 return subRule.size().height();-
4767 else if (subRule.hasBox() || subRule.hasBorder()) {-
4768 QFontMetrics fm = opt ? opt->fontMetrics : w->fontMetrics();-
4769 return subRule.size(QSize(0, fm.height())).height();-
4770 }-
4771 break;-
4772 }-
4773-
4774 case PM_MdiSubWindowFrameWidth:-
4775 if (rule.hasBox() || rule.hasBorder()) {-
4776 return (rule.border() ? rule.border()->borders[LeftEdge] : 0)-
4777 + (rule.hasBox() ? rule.box()->paddings[LeftEdge]+rule.box()->margins[LeftEdge]: 0);-
4778 }-
4779 break;-
4780-
4781 case PM_MdiSubWindowMinimizedWidth: {-
4782 QRenderRule subRule = renderRule(w, PseudoElement_None, PseudoClass_Minimized);-
4783 int width = subRule.size().width();-
4784 if (width != -1)-
4785 return width;-
4786 break;-
4787 }-
4788 default:-
4789 break;-
4790 }-
4791-
4792 return baseStyle()->pixelMetric(m, opt, w);-
4793}-
4794-
4795QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,-
4796 const QSize &csz, const QWidget *w) const-
4797{-
4798 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->sizeFromContents(ct, opt, csz, w); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
4799-
4800 QRenderRule rule = renderRule(w, opt);-
4801 QSize sz = rule.adjustSize(csz);-
4802-
4803 switch (ct) {-
4804 case CT_SpinBox:-
4805 if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {-
4806-
4807 QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);-
4808 if (subRule.hasDrawable()) {-
4809 QRect r = positionRect(w, rule, subRule, PseudoElement_SpinBoxUpButton,-
4810 opt->rect, opt->direction);-
4811 sz += QSize(r.width(), 0);-
4812 } else {-
4813 QSize defaultUpSize = defaultSize(w, subRule.size(), spinbox->rect, PseudoElement_SpinBoxUpButton);-
4814 sz += QSize(defaultUpSize.width(), 0);-
4815 }-
4816 if (rule.hasBox() || rule.hasBorder() || !rule.hasNativeBorder())-
4817 sz = rule.boxSize(sz);-
4818 return sz;-
4819 }-
4820 break;-
4821 case CT_ToolButton:-
4822 if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw())-
4823 sz += QSize(3, 3);-
4824-
4825 case CT_ComboBox:-
4826 case CT_PushButton:-
4827 if (rule.hasBox() || !rule.hasNativeBorder()) {-
4828 if(ct == CT_ComboBox) {-
4829-
4830 QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown);-
4831 QRect comboRect = positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction);-
4832-
4833 sz += QSize(comboRect.width() + 2, 0);-
4834 }-
4835 return rule.boxSize(sz);-
4836 }-
4837 sz = rule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w)-
4838 : QWindowsStyle::sizeFromContents(ct, opt, sz, w);-
4839 return rule.boxSize(sz, Margin);-
4840-
4841 case CT_HeaderSection: {-
4842 if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {-
4843 QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);-
4844 if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) {-
4845 sz = subRule.adjustSize(csz);-
4846 if (!subRule.hasGeometry()) {-
4847 QSize nativeContentsSize;-
4848 bool nullIcon = hdr->icon.isNull();-
4849 int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, w);-
4850 const QSize txt = subRule.hasFont ? QFontMetrics(subRule.font).size(0, hdr->text)-
4851 : hdr->fontMetrics.size(0, hdr->text);-
4852 nativeContentsSize.setHeight(qMax(iconSize, txt.height()));-
4853 nativeContentsSize.setWidth(iconSize + txt.width());-
4854 sz = sz.expandedTo(nativeContentsSize);-
4855 }-
4856 return subRule.size(sz);-
4857 }-
4858 return subRule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w)-
4859 : QWindowsStyle::sizeFromContents(ct, opt, sz, w);-
4860 }-
4861 }-
4862 break;-
4863 case CT_GroupBox:-
4864 case CT_LineEdit:-
4865-
4866 if (qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0))-
4867 return csz;-
4868-
4869 if (rule.hasBox() || !rule.hasNativeBorder()) {-
4870 return rule.boxSize(sz);-
4871 }-
4872 break;-
4873-
4874 case CT_CheckBox:-
4875 case CT_RadioButton:-
4876 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {-
4877 if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {-
4878 bool isRadio = (ct == CT_RadioButton);-
4879 int iw = pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth-
4880 : PM_IndicatorWidth, btn, w);-
4881 int ih = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight-
4882 : PM_IndicatorHeight, btn, w);-
4883-
4884 int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing-
4885 : PM_CheckBoxLabelSpacing, btn, w);-
4886 sz.setWidth(sz.width() + iw + spacing);-
4887 sz.setHeight(qMax(sz.height(), ih));-
4888 return rule.boxSize(sz);-
4889 }-
4890 }-
4891 break;-
4892-
4893 case CT_Menu:-
4894 case CT_MenuBar:-
4895 case CT_ScrollBar:-
4896 if (rule.hasBox() || rule.hasBorder())-
4897 return sz;-
4898 break;-
4899-
4900 case CT_MenuItem:-
4901 if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {-
4902 PseudoElement pe = (mi->menuItemType == QStyleOptionMenuItem::Separator)-
4903 ? PseudoElement_MenuSeparator : PseudoElement_Item;-
4904 QRenderRule subRule = renderRule(w, opt, pe);-
4905 if ((pe == PseudoElement_MenuSeparator) && subRule.hasContentsSize()) {-
4906 return QSize(sz.width(), subRule.size().height());-
4907 } else if ((pe == PseudoElement_Item) && (subRule.hasBox() || subRule.hasBorder())) {-
4908 int width = csz.width();-
4909 if (mi->text.contains(QLatin1Char('\t')))-
4910 width += 12;-
4911 return subRule.boxSize(subRule.adjustSize(QSize(width, csz.height())));-
4912 }-
4913 }-
4914 break;-
4915-
4916 case CT_Splitter:-
4917 case CT_MenuBarItem: {-
4918 PseudoElement pe = (ct == CT_Splitter) ? PseudoElement_SplitterHandle : PseudoElement_Item;-
4919 QRenderRule subRule = renderRule(w, opt, pe);-
4920 if (subRule.hasBox() || subRule.hasBorder())-
4921 return subRule.boxSize(sz);-
4922 break;-
4923 }-
4924-
4925 case CT_ProgressBar:-
4926 case CT_SizeGrip:-
4927 return (rule.hasContentsSize())-
4928 ? rule.size(sz)-
4929 : rule.boxSize(baseStyle()->sizeFromContents(ct, opt, sz, w));-
4930 break;
dead code: break;
-
4931-
4932 case CT_Slider:-
4933 if (rule.hasBorder() || rule.hasBox() || rule.hasGeometry())-
4934 return rule.boxSize(sz);-
4935 break;-
4936-
4937-
4938 case CT_TabBarTab: {-
4939 QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);-
4940 if (subRule.hasBox() || !subRule.hasNativeBorder()) {-
4941 int spaceForIcon = 0;-
4942 bool vertical = false;-
4943 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {-
4944 if (!tab->icon.isNull())-
4945 spaceForIcon = 6 + 4 + 2 ;-
4946 vertical = verticalTabs(tab->shape);-
4947 }-
4948 sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0);-
4949 return subRule.boxSize(subRule.adjustSize(sz));-
4950 }-
4951-
4952-
4953-
4954-
4955-
4956-
4957-
4958 sz = subRule.adjustSize(csz);-
4959 break;-
4960 }-
4961-
4962-
4963 case CT_MdiControls:-
4964 if (const QStyleOptionComplex *ccOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {-
4965 if (!hasStyleRule(w, PseudoElement_MdiCloseButton)-
4966 && !hasStyleRule(w, PseudoElement_MdiNormalButton)-
4967 && !hasStyleRule(w, PseudoElement_MdiMinButton))-
4968 break;-
4969-
4970 QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList();-
4971 if (layout.isEmpty())-
4972 layout = subControlLayout(QLatin1String("mNX"));-
4973-
4974 int width = 0, height = 0;-
4975 for (int i = 0; i < layout.count(); i++) {-
4976 int layoutButton = layout[i].toInt();-
4977 if (layoutButton < PseudoElement_MdiCloseButton-
4978 || layoutButton > PseudoElement_MdiNormalButton)-
4979 continue;-
4980 QStyle::SubControl sc = knownPseudoElements[layoutButton].subControl;-
4981 if (!(ccOpt->subControls & sc))-
4982 continue;-
4983 QRenderRule subRule = renderRule(w, opt, layoutButton);-
4984 QSize sz = subRule.size();-
4985 width += sz.width();-
4986 height = qMax(height, sz.height());-
4987 }-
4988-
4989 return QSize(width, height);-
4990 }-
4991 break;-
4992-
4993-
4994 case CT_ItemViewItem: {-
4995 QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);-
4996 sz = baseStyle()->sizeFromContents(ct, opt, csz, w);-
4997 sz = subRule.adjustSize(sz);-
4998 if (subRule.hasBox() || subRule.hasBorder())-
4999 sz = subRule.boxSize(sz);-
5000 return sz;-
5001 }-
5002-
5003-
5004 default:-
5005 break;-
5006 }-
5007-
5008 return baseStyle()->sizeFromContents(ct, opt, sz, w);-
5009}-
5010-
5011-
5012-
5013-
5014static QLatin1String propertyNameForStandardPixmap(QStyle::StandardPixmap sp)-
5015{-
5016 switch (sp) {-
5017 case QStyle::SP_TitleBarMenuButton: return QLatin1String("titlebar-menu-icon");-
5018 case QStyle::SP_TitleBarMinButton: return QLatin1String("titlebar-minimize-icon");-
5019 case QStyle::SP_TitleBarMaxButton: return QLatin1String("titlebar-maximize-icon");-
5020 case QStyle::SP_TitleBarCloseButton: return QLatin1String("titlebar-close-icon");-
5021 case QStyle::SP_TitleBarNormalButton: return QLatin1String("titlebar-normal-icon");-
5022 case QStyle::SP_TitleBarShadeButton: return QLatin1String("titlebar-shade-icon");-
5023 case QStyle::SP_TitleBarUnshadeButton: return QLatin1String("titlebar-unshade-icon");-
5024 case QStyle::SP_TitleBarContextHelpButton: return QLatin1String("titlebar-contexthelp-icon");-
5025 case QStyle::SP_DockWidgetCloseButton: return QLatin1String("dockwidget-close-icon");-
5026 case QStyle::SP_MessageBoxInformation: return QLatin1String("messagebox-information-icon");-
5027 case QStyle::SP_MessageBoxWarning: return QLatin1String("messagebox-warning-icon");-
5028 case QStyle::SP_MessageBoxCritical: return QLatin1String("messagebox-critical-icon");-
5029 case QStyle::SP_MessageBoxQuestion: return QLatin1String("messagebox-question-icon");-
5030 case QStyle::SP_DesktopIcon: return QLatin1String("desktop-icon");-
5031 case QStyle::SP_TrashIcon: return QLatin1String("trash-icon");-
5032 case QStyle::SP_ComputerIcon: return QLatin1String("computer-icon");-
5033 case QStyle::SP_DriveFDIcon: return QLatin1String("floppy-icon");-
5034 case QStyle::SP_DriveHDIcon: return QLatin1String("harddisk-icon");-
5035 case QStyle::SP_DriveCDIcon: return QLatin1String("cd-icon");-
5036 case QStyle::SP_DriveDVDIcon: return QLatin1String("dvd-icon");-
5037 case QStyle::SP_DriveNetIcon: return QLatin1String("network-icon");-
5038 case QStyle::SP_DirOpenIcon: return QLatin1String("directory-open-icon");-
5039 case QStyle::SP_DirClosedIcon: return QLatin1String("directory-closed-icon");-
5040 case QStyle::SP_DirLinkIcon: return QLatin1String("directory-link-icon");-
5041 case QStyle::SP_FileIcon: return QLatin1String("file-icon");-
5042 case QStyle::SP_FileLinkIcon: return QLatin1String("file-link-icon");-
5043 case QStyle::SP_FileDialogStart: return QLatin1String("filedialog-start-icon");-
5044 case QStyle::SP_FileDialogEnd: return QLatin1String("filedialog-end-icon");-
5045 case QStyle::SP_FileDialogToParent: return QLatin1String("filedialog-parent-directory-icon");-
5046 case QStyle::SP_FileDialogNewFolder: return QLatin1String("filedialog-new-directory-icon");-
5047 case QStyle::SP_FileDialogDetailedView: return QLatin1String("filedialog-detailedview-icon");-
5048 case QStyle::SP_FileDialogInfoView: return QLatin1String("filedialog-infoview-icon");-
5049 case QStyle::SP_FileDialogContentsView: return QLatin1String("filedialog-contentsview-icon");-
5050 case QStyle::SP_FileDialogListView: return QLatin1String("filedialog-listview-icon");-
5051 case QStyle::SP_FileDialogBack: return QLatin1String("filedialog-backward-icon");-
5052 case QStyle::SP_DirIcon: return QLatin1String("directory-icon");-
5053 case QStyle::SP_DialogOkButton: return QLatin1String("dialog-ok-icon");-
5054 case QStyle::SP_DialogCancelButton: return QLatin1String("dialog-cancel-icon");-
5055 case QStyle::SP_DialogHelpButton: return QLatin1String("dialog-help-icon");-
5056 case QStyle::SP_DialogOpenButton: return QLatin1String("dialog-open-icon");-
5057 case QStyle::SP_DialogSaveButton: return QLatin1String("dialog-save-icon");-
5058 case QStyle::SP_DialogCloseButton: return QLatin1String("dialog-close-icon");-
5059 case QStyle::SP_DialogApplyButton: return QLatin1String("dialog-apply-icon");-
5060 case QStyle::SP_DialogResetButton: return QLatin1String("dialog-reset-icon");-
5061 case QStyle::SP_DialogDiscardButton: return QLatin1String("discard-icon");-
5062 case QStyle::SP_DialogYesButton: return QLatin1String("dialog-yes-icon");-
5063 case QStyle::SP_DialogNoButton: return QLatin1String("dialog-no-icon");-
5064 case QStyle::SP_ArrowUp: return QLatin1String("uparrow-icon");-
5065 case QStyle::SP_ArrowDown: return QLatin1String("downarrow-icon");-
5066 case QStyle::SP_ArrowLeft: return QLatin1String("leftarrow-icon");-
5067 case QStyle::SP_ArrowRight: return QLatin1String("rightarrow-icon");-
5068 case QStyle::SP_ArrowBack: return QLatin1String("backward-icon");-
5069 case QStyle::SP_ArrowForward: return QLatin1String("forward-icon");-
5070 case QStyle::SP_DirHomeIcon: return QLatin1String("home-icon");-
5071 default: return QLatin1String("");-
5072 }-
5073}-
5074-
5075QIcon QStyleSheetStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *opt,-
5076 const QWidget *w) const-
5077{-
5078 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->standardIcon(standardIcon, opt, w); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
5079 QString s = propertyNameForStandardPixmap(standardIcon);-
5080 if (!s.isEmpty()) {-
5081 QRenderRule rule = renderRule(w, opt);-
5082 if (rule.hasStyleHint(s))-
5083 return qvariant_cast<QIcon>(rule.styleHint(s));-
5084 }-
5085 return baseStyle()->standardIcon(standardIcon, opt, w);-
5086}-
5087-
5088QPalette QStyleSheetStyle::standardPalette() const-
5089{-
5090 return baseStyle()->standardPalette();-
5091}-
5092-
5093QPixmap QStyleSheetStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,-
5094 const QWidget *w) const-
5095{-
5096 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->standardPixmap(standardPixmap, opt, w); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
5097 QString s = propertyNameForStandardPixmap(standardPixmap);-
5098 if (!s.isEmpty()) {-
5099 QRenderRule rule = renderRule(w, opt);-
5100 if (rule.hasStyleHint(s)) {-
5101 QIcon icon = qvariant_cast<QIcon>(rule.styleHint(s));-
5102 return icon.pixmap(16, 16);-
5103 }-
5104 }-
5105 return baseStyle()->standardPixmap(standardPixmap, opt, w);-
5106}-
5107-
5108int QStyleSheetStyle::layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,-
5109 Qt::Orientation orientation, const QStyleOption *option,-
5110 const QWidget *widget) const-
5111{-
5112 return baseStyle()->layoutSpacing(control1, control2, orientation, option, widget);-
5113}-
5114-
5115int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w,-
5116 QStyleHintReturn *shret) const-
5117{-
5118 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->styleHint(sh, opt, w, shret); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
5119-
5120-
5121 if (sh == SH_Widget_ShareActivation)-
5122 return baseStyle()->styleHint(sh, opt, w, shret);-
5123-
5124 QRenderRule rule = renderRule(w, opt);-
5125 QString s;-
5126 switch (sh) {-
5127 case SH_LineEdit_PasswordCharacter: s = QLatin1String("lineedit-password-character"); break;-
5128 case SH_LineEdit_PasswordMaskDelay: s = QLatin1String("lineedit-password-mask-delay"); break;-
5129 case SH_DitherDisabledText: s = QLatin1String("dither-disabled-text"); break;-
5130 case SH_EtchDisabledText: s = QLatin1String("etch-disabled-text"); break;-
5131 case SH_ItemView_ActivateItemOnSingleClick: s = QLatin1String("activate-on-singleclick"); break;-
5132 case SH_ItemView_ShowDecorationSelected: s = QLatin1String("show-decoration-selected"); break;-
5133 case SH_Table_GridLineColor: s = QLatin1String("gridline-color"); break;-
5134 case SH_DialogButtonLayout: s = QLatin1String("button-layout"); break;-
5135 case SH_ToolTipLabel_Opacity: s = QLatin1String("opacity"); break;-
5136 case SH_ComboBox_Popup: s = QLatin1String("combobox-popup"); break;-
5137 case SH_ComboBox_ListMouseTracking: s = QLatin1String("combobox-list-mousetracking"); break;-
5138 case SH_MenuBar_AltKeyNavigation: s = QLatin1String("menubar-altkey-navigation"); break;-
5139 case SH_Menu_Scrollable: s = QLatin1String("menu-scrollable"); break;-
5140 case SH_DrawMenuBarSeparator: s = QLatin1String("menubar-separator"); break;-
5141 case SH_MenuBar_MouseTracking: s = QLatin1String("mouse-tracking"); break;-
5142 case SH_SpinBox_ClickAutoRepeatRate: s = QLatin1String("spinbox-click-autorepeat-rate"); break;-
5143 case SH_SpinControls_DisableOnBounds: s = QLatin1String("spincontrol-disable-on-bounds"); break;-
5144 case SH_MessageBox_TextInteractionFlags: s = QLatin1String("messagebox-text-interaction-flags"); break;-
5145 case SH_ToolButton_PopupDelay: s = QLatin1String("toolbutton-popup-delay"); break;-
5146 case SH_ToolBox_SelectedPageTitleBold:-
5147 if (renderRule(w, opt, PseudoElement_ToolBoxTab).hasFont)-
5148 return 0;-
5149 break;-
5150 case SH_GroupBox_TextLabelColor:-
5151 if (rule.hasPalette() && rule.palette()->foreground.style() != Qt::NoBrush)-
5152 return rule.palette()->foreground.color().rgba();-
5153 break;-
5154 case SH_ScrollView_FrameOnlyAroundContents: s = QLatin1String("scrollview-frame-around-contents"); break;-
5155 case SH_ScrollBar_ContextMenu: s = QLatin1String("scrollbar-contextmenu"); break;-
5156 case SH_ScrollBar_LeftClickAbsolutePosition: s = QLatin1String("scrollbar-leftclick-absolute-position"); break;-
5157 case SH_ScrollBar_MiddleClickAbsolutePosition: s = QLatin1String("scrollbar-middleclick-absolute-position"); break;-
5158 case SH_ScrollBar_RollBetweenButtons: s = QLatin1String("scrollbar-roll-between-buttons"); break;-
5159 case SH_ScrollBar_ScrollWhenPointerLeavesControl: s = QLatin1String("scrollbar-scroll-when-pointer-leaves-control"); break;-
5160 case SH_TabBar_Alignment:-
5161-
5162 if (qobject_cast<const QTabWidget *>(w)) {-
5163 rule = renderRule(w, opt, PseudoElement_TabWidgetTabBar);-
5164 if (rule.hasPosition())-
5165 return rule.position()->position;-
5166 }-
5167-
5168 s = QLatin1String("alignment");-
5169 break;-
5170-
5171 case SH_TabBar_CloseButtonPosition:-
5172 rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton);-
5173 if (rule.hasPosition()) {-
5174 Qt::Alignment align = rule.position()->position;-
5175 if (align & Qt::AlignLeft || align & Qt::AlignTop)-
5176 return QTabBar::LeftSide;-
5177 if (align & Qt::AlignRight || align & Qt::AlignBottom)-
5178 return QTabBar::RightSide;-
5179 }-
5180 break;-
5181-
5182 case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break;-
5183 case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break;-
5184 case SH_ComboBox_PopupFrameStyle:-
5185-
5186 if (qobject_cast<const QComboBox *>(w)) {-
5187 QAbstractItemView *view = w->findChild<QAbstractItemView *>();-
5188 if (view) {-
5189 view->ensurePolished();-
5190 QRenderRule subRule = renderRule(view, PseudoElement_None);-
5191 if (subRule.hasBox() || !subRule.hasNativeBorder())-
5192 return QFrame::NoFrame;-
5193 }-
5194 }-
5195-
5196 break;-
5197 case SH_DialogButtonBox_ButtonsHaveIcons: s = QLatin1String("dialogbuttonbox-buttons-have-icons"); break;-
5198 case SH_Workspace_FillSpaceOnMaximize: s = QLatin1String("mdi-fill-space-on-maximize"); break;-
5199 case SH_TitleBar_NoBorder:-
5200 if (rule.hasBorder())-
5201 return !rule.border()->borders[LeftEdge];-
5202 break;-
5203 case SH_TitleBar_AutoRaise: {-
5204 QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar);-
5205 if (subRule.hasDrawable())-
5206 return 1;-
5207 break;-
5208 }-
5209 case SH_ItemView_ArrowKeysNavigateIntoChildren: s = QLatin1String("arrow-keys-navigate-into-children"); break;-
5210 case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: s = QLatin1String("paint-alternating-row-colors-for-empty-area"); break;-
5211 default: break;-
5212 }-
5213 if (!s.isEmpty() && rule.hasStyleHint(s)) {-
5214 return rule.styleHint(s).toInt();-
5215 }-
5216-
5217 return baseStyle()->styleHint(sh, opt, w, shret);-
5218}-
5219-
5220QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,-
5221 const QWidget *w) const-
5222{-
5223 if (globalStyleSheetStyle != 0
globalStyleSheetStyle != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& globalStyleSheetStyle != this
globalStyleSheetStyle != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) { return
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
baseStyle()->subControlRect(cc, opt, sc, w);
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
} QStyleSheetStyleRecursionGuard recursion_guard(this);
0
5224-
5225 QRenderRule rule = renderRule(w, opt);-
5226 switch (cc) {-
5227 case
never executed: case CC_ComboBox:
CC_ComboBox:
never executed: case CC_ComboBox:
0
5228 if (const
const QStyleOp...mboBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)
const QStyleOp...mboBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5229 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| !rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5230 switch (sc) {-
5231 case
never executed: case SC_ComboBoxFrame:
SC_ComboBoxFrame:
never executed: case SC_ComboBoxFrame:
return
never executed: return rule.borderRect(opt->rect);
rule.borderRect(opt->rect);
never executed: return rule.borderRect(opt->rect);
0
5232 case
never executed: case SC_ComboBoxEditField:
SC_ComboBoxEditField:
never executed: case SC_ComboBoxEditField:
0
5233 {-
5234 QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown);-
5235 QRect r = rule.contentsRect(opt->rect);-
5236 QRect r2 = positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown,-
5237 opt->rect, opt->direction);-
5238 if (subRule.hasPosition()
subRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
&& subRule.position()->position & Qt::AlignLeft
subRule.positi... Qt::AlignLeftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5239 return
never executed: return visualRect(opt->direction, r, r.adjusted(r2.width(),0,0,0));
visualRect(opt->direction, r, r.adjusted(r2.width(),0,0,0));
never executed: return visualRect(opt->direction, r, r.adjusted(r2.width(),0,0,0));
0
5240 } else {-
5241 return
never executed: return visualRect(opt->direction, r, r.adjusted(0,0,-r2.width(),0));
visualRect(opt->direction, r, r.adjusted(0,0,-r2.width(),0));
never executed: return visualRect(opt->direction, r, r.adjusted(0,0,-r2.width(),0));
0
5242 }-
5243 }-
5244 case
never executed: case SC_ComboBoxArrow:
SC_ComboBoxArrow:
never executed: case SC_ComboBoxArrow:
{
0
5245 QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown);-
5246 return
never executed: return positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction);
positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction);
never executed: return positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction);
0
5247 }-
5248 case
never executed: case SC_ComboBoxListBoxPopup:
SC_ComboBoxListBoxPopup:
never executed: case SC_ComboBoxListBoxPopup:
0
5249 default
never executed: default:
:
never executed: default:
0
5250 return
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
baseStyle()->subControlRect(cc, opt, sc, w);
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
0
5251 }-
5252 }-
5253-
5254 QStyleOptionComboBox comboBox(*cb);-
5255 comboBox.rect = rule.borderRect(opt->rect);-
5256 return
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w) : QWindowsStyle::subControlRect(cc, &comboBox, sc, w);
rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w)
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w) : QWindowsStyle::subControlRect(cc, &comboBox, sc, w);
0
5257 : QWindowsStyle::subControlRect(cc, &comboBox, sc, w);
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w) : QWindowsStyle::subControlRect(cc, &comboBox, sc, w);
0
5258 }-
5259 break;
never executed: break;
0
5260-
5261-
5262 case
never executed: case CC_SpinBox:
CC_SpinBox:
never executed: case CC_SpinBox:
0
5263 if (const
const QStyleOp...pinBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)
const QStyleOp...pinBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5264 QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);-
5265 QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);-
5266 bool ruleMatch = rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| !rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
5267 bool upRuleMatch = upRule.hasGeometry()
upRule.hasGeometry()Description
TRUEnever evaluated
FALSEnever evaluated
|| upRule.hasPosition()
upRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
5268 bool downRuleMatch = downRule.hasGeometry()
downRule.hasGeometry()Description
TRUEnever evaluated
FALSEnever evaluated
|| downRule.hasPosition()
downRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
5269 if (ruleMatch
ruleMatchDescription
TRUEnever evaluated
FALSEnever evaluated
|| upRuleMatch
upRuleMatchDescription
TRUEnever evaluated
FALSEnever evaluated
|| downRuleMatch
downRuleMatchDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5270 switch (sc) {-
5271 case
never executed: case SC_SpinBoxFrame:
SC_SpinBoxFrame:
never executed: case SC_SpinBoxFrame:
0
5272 return
never executed: return rule.borderRect(opt->rect);
rule.borderRect(opt->rect);
never executed: return rule.borderRect(opt->rect);
0
5273 case
never executed: case SC_SpinBoxEditField:
SC_SpinBoxEditField:
never executed: case SC_SpinBoxEditField:
0
5274 {-
5275 QRect r = rule.contentsRect(opt->rect);-
5276-
5277 Qt::Alignment upAlign, downAlign;-
5278-
5279 upAlign = upRule.hasPosition()
upRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
? upRule.position()->position
0
5280 : Qt::Alignment(Qt::AlignRight);-
5281 upAlign = resolveAlignment(opt->direction, upAlign);-
5282-
5283 downAlign = downRule.hasPosition()
downRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
? downRule.position()->position
0
5284 : Qt::Alignment(Qt::AlignRight);-
5285 downAlign = resolveAlignment(opt->direction, downAlign);-
5286-
5287 int upSize = subControlRect(CC_SpinBox, opt, SC_SpinBoxUp, w).width();-
5288 int downSize = subControlRect(CC_SpinBox, opt, SC_SpinBoxDown, w).width();-
5289 int widestL = qMax((upAlign & Qt::AlignLeft) ? upSize : 0,-
5290 (downAlign & Qt::AlignLeft) ? downSize : 0);-
5291 int widestR = qMax((upAlign & Qt::AlignRight) ? upSize : 0,-
5292 (downAlign & Qt::AlignRight) ? downSize : 0);-
5293 r.setRight(r.right() - widestR);-
5294 r.setLeft(r.left() + widestL);-
5295 return
never executed: return r;
r;
never executed: return r;
0
5296 }-
5297 case
never executed: case SC_SpinBoxDown:
SC_SpinBoxDown:
never executed: case SC_SpinBoxDown:
0
5298 if (downRuleMatch
downRuleMatchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
5299 return
never executed: return positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton, opt->rect, opt->direction);
positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton,
never executed: return positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton, opt->rect, opt->direction);
0
5300 opt->rect, opt->direction);
never executed: return positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton, opt->rect, opt->direction);
0
5301 break;
never executed: break;
0
5302 case
never executed: case SC_SpinBoxUp:
SC_SpinBoxUp:
never executed: case SC_SpinBoxUp:
0
5303 if (upRuleMatch
upRuleMatchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
5304 return
never executed: return positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton, opt->rect, opt->direction);
positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton,
never executed: return positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton, opt->rect, opt->direction);
0
5305 opt->rect, opt->direction);
never executed: return positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton, opt->rect, opt->direction);
0
5306 break;
never executed: break;
0
5307 default
never executed: default:
:
never executed: default:
0
5308 break;
never executed: break;
0
5309 }-
5310-
5311 return
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
baseStyle()->subControlRect(cc, opt, sc, w);
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
0
5312 }-
5313-
5314 QStyleOptionSpinBox spinBox(*spin);-
5315 spinBox.rect = rule.borderRect(opt->rect);-
5316 return
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w) : QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w)
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w) : QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
0
5317 : QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w) : QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
0
5318 }-
5319 break;
never executed: break;
0
5320-
5321-
5322 case
never executed: case CC_GroupBox:
CC_GroupBox:
never executed: case CC_GroupBox:
0
5323 if (const
const QStyleOp...oupBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)
const QStyleOp...oupBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5324 switch (sc) {-
5325 case
never executed: case SC_GroupBoxFrame:
SC_GroupBoxFrame:
never executed: case SC_GroupBoxFrame:
0
5326 case
never executed: case SC_GroupBoxContents:
SC_GroupBoxContents:
never executed: case SC_GroupBoxContents:
{
0
5327 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| !rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5328 return
never executed: return sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect) : rule.contentsRect(opt->rect);
sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect)
never executed: return sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect) : rule.contentsRect(opt->rect);
0
5329 : rule.contentsRect(opt->rect);
never executed: return sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect) : rule.contentsRect(opt->rect);
0
5330 }-
5331 QStyleOptionGroupBox groupBox(*gb);-
5332 groupBox.rect = rule.borderRect(opt->rect);-
5333 return
never executed: return baseStyle()->subControlRect(cc, &groupBox, sc, w);
baseStyle()->subControlRect(cc, &groupBox, sc, w);
never executed: return baseStyle()->subControlRect(cc, &groupBox, sc, w);
0
5334 }-
5335 default
never executed: default:
:
never executed: default:
0
5336 case
never executed: case SC_GroupBoxLabel:
SC_GroupBoxLabel:
never executed: case SC_GroupBoxLabel:
0
5337 case
never executed: case SC_GroupBoxCheckBox:
SC_GroupBoxCheckBox:
never executed: case SC_GroupBoxCheckBox:
{
0
5338 QRenderRule indRule = renderRule(w, opt, PseudoElement_GroupBoxIndicator);-
5339 QRenderRule labelRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);-
5340 if (!labelRule.hasPosition()
!labelRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
&& !labelRule.hasGeometry()
!labelRule.hasGeometry()Description
TRUEnever evaluated
FALSEnever evaluated
&& !labelRule.hasBox()
!labelRule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
0
5341 && !labelRule.hasBorder()
!labelRule.hasBorder()Description
TRUEnever evaluated
FALSEnever evaluated
&& !indRule.hasContentsSize()
!indRule.hasContentsSize()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5342 QStyleOptionGroupBox groupBox(*gb);-
5343 groupBox.rect = rule.borderRect(opt->rect);-
5344 return
never executed: return baseStyle()->subControlRect(cc, &groupBox, sc, w);
baseStyle()->subControlRect(cc, &groupBox, sc, w);
never executed: return baseStyle()->subControlRect(cc, &groupBox, sc, w);
0
5345 }-
5346 int tw = opt->fontMetrics.width(gb->text);-
5347 int th = opt->fontMetrics.height();-
5348 int spacing = pixelMetric(QStyle::PM_CheckBoxLabelSpacing, opt, w);-
5349 int iw = pixelMetric(QStyle::PM_IndicatorWidth, opt, w);-
5350 int ih = pixelMetric(QStyle::PM_IndicatorHeight, opt, w);-
5351-
5352 if (gb->subControls & QStyle::SC_GroupBoxCheckBox
gb->subControl...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5353 tw = tw + iw + spacing;-
5354 th = qMax(th, ih);-
5355 }
never executed: end of block
0
5356 if (!labelRule.hasGeometry()
!labelRule.hasGeometry()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5357 labelRule.geo = new QStyleSheetGeometryData(tw, th, tw, th, -1, -1);-
5358 }
never executed: end of block
else {
0
5359 labelRule.geo->width = tw;-
5360 labelRule.geo->height = th;-
5361 }
never executed: end of block
0
5362 if (!labelRule.hasPosition()
!labelRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5363 labelRule.p = new QStyleSheetPositionData(0, 0, 0, 0, defaultOrigin(PseudoElement_GroupBoxTitle),-
5364 gb->textAlignment, PositionMode_Static);-
5365 }
never executed: end of block
0
5366 QRect r = positionRect(w, rule, labelRule, PseudoElement_GroupBoxTitle,-
5367 opt->rect, opt->direction);-
5368 if (gb->subControls & SC_GroupBoxCheckBox
gb->subControl...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5369 r = labelRule.contentsRect(r);-
5370 if (sc == SC_GroupBoxLabel
sc == SC_GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5371 r.setLeft(r.left() + iw + spacing);-
5372 r.setTop(r.center().y() - th/2);-
5373 }
never executed: end of block
else {
0
5374 r = QRect(r.left(), r.center().y() - ih/2, iw, ih);-
5375 }
never executed: end of block
0
5376 return
never executed: return r;
r;
never executed: return r;
0
5377 } else {-
5378 return
never executed: return labelRule.contentsRect(r);
labelRule.contentsRect(r);
never executed: return labelRule.contentsRect(r);
0
5379 }-
5380 }-
5381 }-
5382 }-
5383 break;
never executed: break;
0
5384-
5385 case
never executed: case CC_ToolButton:
CC_ToolButton:
never executed: case CC_ToolButton:
0
5386 if (const
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5387 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
|| !rule.hasNativeBorder()
!rule.hasNativeBorder()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5388 switch (sc) {-
5389 case
never executed: case SC_ToolButton:
SC_ToolButton:
never executed: case SC_ToolButton:
return
never executed: return rule.borderRect(opt->rect);
rule.borderRect(opt->rect);
never executed: return rule.borderRect(opt->rect);
0
5390 case
never executed: case SC_ToolButtonMenu:
SC_ToolButtonMenu:
never executed: case SC_ToolButtonMenu:
{
0
5391 QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu);-
5392 return
never executed: return positionRect(w, rule, subRule, PseudoElement_ToolButtonMenu, opt->rect, opt->direction);
positionRect(w, rule, subRule, PseudoElement_ToolButtonMenu, opt->rect, opt->direction);
never executed: return positionRect(w, rule, subRule, PseudoElement_ToolButtonMenu, opt->rect, opt->direction);
0
5393 }-
5394 default
never executed: default:
:
never executed: default:
0
5395 break;
never executed: break;
0
5396 }-
5397 }-
5398-
5399 QStyleOptionToolButton tool(*tb);-
5400 tool.rect = rule.borderRect(opt->rect);-
5401 return
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w) : QWindowsStyle::subControlRect(cc, &tool, sc, w);
rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w)
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w) : QWindowsStyle::subControlRect(cc, &tool, sc, w);
0
5402 : QWindowsStyle::subControlRect(cc, &tool, sc, w);
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w) : QWindowsStyle::subControlRect(cc, &tool, sc, w);
0
5403 }-
5404 break;
never executed: break;
0
5405-
5406-
5407 case
never executed: case CC_ScrollBar:
CC_ScrollBar:
never executed: case CC_ScrollBar:
0
5408 if (const
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5409 QStyleOptionSlider styleOptionSlider(*sb);-
5410 styleOptionSlider.rect = rule.borderRect(opt->rect);-
5411 if (rule.hasDrawable()
rule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
|| rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5412 QRect grooveRect;-
5413 if (!rule.hasBox()
!rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5414 grooveRect = rule.baseStyleCanDraw()
rule.baseStyleCanDraw()Description
TRUEnever evaluated
FALSEnever evaluated
? baseStyle()->subControlRect(cc, sb, SC_ScrollBarGroove, w)
0
5415 : QWindowsStyle::subControlRect(cc, sb, SC_ScrollBarGroove, w);-
5416 }
never executed: end of block
else {
0
5417 grooveRect = rule.contentsRect(opt->rect);-
5418 }
never executed: end of block
0
5419-
5420 PseudoElement pe = PseudoElement_None;-
5421-
5422 switch (sc) {-
5423 case
never executed: case SC_ScrollBarGroove:
SC_ScrollBarGroove:
never executed: case SC_ScrollBarGroove:
0
5424 return
never executed: return grooveRect;
grooveRect;
never executed: return grooveRect;
0
5425 case
never executed: case SC_ScrollBarAddPage:
SC_ScrollBarAddPage:
never executed: case SC_ScrollBarAddPage:
0
5426 case
never executed: case SC_ScrollBarSubPage:
SC_ScrollBarSubPage:
never executed: case SC_ScrollBarSubPage:
0
5427 case
never executed: case SC_ScrollBarSlider:
SC_ScrollBarSlider:
never executed: case SC_ScrollBarSlider:
{
0
5428 QRect contentRect = grooveRect;-
5429 if (hasStyleRule(w, PseudoElement_ScrollBarSlider)
hasStyleRule(w...rollBarSlider)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5430 QRenderRule sliderRule = renderRule(w, opt, PseudoElement_ScrollBarSlider);-
5431 Origin origin = sliderRule.hasPosition()
sliderRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
? sliderRule.position()->origin : defaultOrigin(PseudoElement_ScrollBarSlider);
0
5432 contentRect = rule.originRect(opt->rect, origin);-
5433 }
never executed: end of block
0
5434 int maxlen = (
(styleOptionSl...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
styleOptionSlider.orientation == Qt::Horizontal)
(styleOptionSl...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
? contentRect.width() : contentRect.height();
0
5435 int sliderlen;-
5436 if (sb->maximum != sb->minimum
sb->maximum != sb->minimumDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5437 uint range = sb->maximum - sb->minimum;-
5438 sliderlen = (qint64(sb->pageStep) * maxlen) / (range + sb->pageStep);-
5439-
5440 int slidermin = pixelMetric(PM_ScrollBarSliderMin, sb, w);-
5441 if (sliderlen < slidermin
sliderlen < sliderminDescription
TRUEnever evaluated
FALSEnever evaluated
|| range > 2147483647 / 2
range > 2147483647 / 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5442 sliderlen = slidermin;
never executed: sliderlen = slidermin;
0
5443 if (sliderlen > maxlen
sliderlen > maxlenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
5444 sliderlen = maxlen;
never executed: sliderlen = maxlen;
0
5445 }
never executed: end of block
else {
0
5446 sliderlen = maxlen;-
5447 }
never executed: end of block
0
5448-
5449 const int sliderPosition = sb->orientation == Qt::Horizontal && sb->direction == Qt::RightToLeft ? sb->maximum - sb->sliderPosition + sb->minimum : sb->sliderPosition;int sliderstart = (styleOptionSlider.orientation == Qt::Horizontal
styleOptionSli...Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
? contentRect.left() : contentRect.top())
0
5450 + sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition,-
5451 maxlen - sliderlen, sb->upsideDown);-
5452-
5453 QRect sr = (
(sb->orientati...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
sb->orientation == Qt::Horizontal)
(sb->orientati...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
0
5454 ? QRect(sliderstart, contentRect.top(), sliderlen, contentRect.height())-
5455 : QRect(contentRect.left(), sliderstart, contentRect.width(), sliderlen);-
5456 if (sc == SC_ScrollBarSlider
sc == SC_ScrollBarSliderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5457 return
never executed: return sr;
sr;
never executed: return sr;
0
5458 } else if (sc == SC_ScrollBarSubPage
sc == SC_ScrollBarSubPageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5459 return
never executed: return QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight());
QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight());
never executed: return QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight());
0
5460 } else {-
5461 return
never executed: return QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight());
QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight());
never executed: return QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight());
0
5462 }-
5463 break;
dead code: break;
-
5464 }-
5465 case
never executed: case SC_ScrollBarAddLine:
SC_ScrollBarAddLine:
never executed: case SC_ScrollBarAddLine:
pe = PseudoElement_ScrollBarAddLine; break;
never executed: break;
0
5466 case
never executed: case SC_ScrollBarSubLine:
SC_ScrollBarSubLine:
never executed: case SC_ScrollBarSubLine:
pe = PseudoElement_ScrollBarSubLine; break;
never executed: break;
0
5467 case
never executed: case SC_ScrollBarFirst:
SC_ScrollBarFirst:
never executed: case SC_ScrollBarFirst:
pe = PseudoElement_ScrollBarFirst; break;
never executed: break;
0
5468 case
never executed: case SC_ScrollBarLast:
SC_ScrollBarLast:
never executed: case SC_ScrollBarLast:
pe = PseudoElement_ScrollBarLast; break;
never executed: break;
0
5469 default
never executed: default:
:
never executed: default:
break;
never executed: break;
0
5470 }-
5471 if (hasStyleRule(w,pe)
hasStyleRule(w,pe)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5472 QRenderRule subRule = renderRule(w, opt, pe);-
5473 if (subRule.hasPosition()
subRule.hasPosition()Description
TRUEnever evaluated
FALSEnever evaluated
|| subRule.hasGeometry()
subRule.hasGeometry()Description
TRUEnever evaluated
FALSEnever evaluated
|| subRule.hasBox()
subRule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5474 const QStyleSheetPositionData *pos = subRule.position();-
5475 QRect originRect = grooveRect;-
5476 if (rule.hasBox()
rule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5477 Origin origin = (pos
posDescription
TRUEnever evaluated
FALSEnever evaluated
&& pos->origin != Origin_Unknown
pos->origin != Origin_UnknownDescription
TRUEnever evaluated
FALSEnever evaluated
) ? pos->origin : defaultOrigin(pe);
0
5478 originRect = rule.originRect(opt->rect, origin);-
5479 }
never executed: end of block
0
5480 return
never executed: return positionRect(w, subRule, pe, originRect, styleOptionSlider.direction);
positionRect(w, subRule, pe, originRect, styleOptionSlider.direction);
never executed: return positionRect(w, subRule, pe, originRect, styleOptionSlider.direction);
0
5481 }-
5482 }
never executed: end of block
0
5483 }
never executed: end of block
0
5484 return
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w) : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w);
rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w)
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w) : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w);
0
5485 : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w);
never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w) : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w);
0
5486 }-
5487 break;
never executed: break;
0
5488-
5489-
5490-
5491 case
never executed: case CC_Slider:
CC_Slider:
never executed: case CC_Slider:
0
5492 if (const
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5493 QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);-
5494 if (!subRule.hasDrawable()
!subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5495 break;
never executed: break;
0
5496 subRule.img = 0;-
5497 QRect gr = positionRect(w, rule, subRule, PseudoElement_SliderGroove, opt->rect, opt->direction);-
5498 switch (sc) {-
5499 case
never executed: case SC_SliderGroove:
SC_SliderGroove:
never executed: case SC_SliderGroove:
0
5500 return
never executed: return gr;
gr;
never executed: return gr;
0
5501 case
never executed: case SC_SliderHandle:
SC_SliderHandle:
never executed: case SC_SliderHandle:
{
0
5502 bool horizontal = slider->orientation & Qt::Horizontal;-
5503 QRect cr = subRule.contentsRect(gr);-
5504 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SliderHandle);-
5505 int len = horizontal
horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
? subRule2.size().width() : subRule2.size().height();
0
5506 subRule2.img = 0;-
5507 subRule2.geo = 0;-
5508 cr = positionRect(w, subRule2, PseudoElement_SliderHandle, cr, opt->direction);-
5509 int thickness = horizontal
horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
? cr.height() : cr.width();
0
5510 int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition,-
5511 (horizontal ? cr.width() : cr.height()) - len, slider->upsideDown);-
5512 cr = horizontal
horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
? QRect(cr.x() + sliderPos, cr.y(), len, thickness)
0
5513 : QRect(cr.x(), cr.y() + sliderPos, thickness, len);-
5514 return
never executed: return subRule2.borderRect(cr);
subRule2.borderRect(cr);
never executed: return subRule2.borderRect(cr);
0
5515 break;
dead code: break;
}
-
5516 case
never executed: case SC_SliderTickmarks:
SC_SliderTickmarks:
never executed: case SC_SliderTickmarks:
0
5517-
5518 default
never executed: default:
:
never executed: default:
0
5519 break;
never executed: break;
0
5520 }-
5521 }-
5522 break;
never executed: break;
0
5523-
5524-
5525 case
never executed: case CC_MdiControls:
CC_MdiControls:
never executed: case CC_MdiControls:
0
5526 if (hasStyleRule(w, PseudoElement_MdiCloseButton)
hasStyleRule(w...diCloseButton)Description
TRUEnever evaluated
FALSEnever evaluated
0
5527 || hasStyleRule(w, PseudoElement_MdiNormalButton)
hasStyleRule(w...iNormalButton)Description
TRUEnever evaluated
FALSEnever evaluated
0
5528 || hasStyleRule(w, PseudoElement_MdiMinButton)
hasStyleRule(w..._MdiMinButton)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5529 QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList();-
5530 if (layout.isEmpty()
layout.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5531 layout = subControlLayout(QLatin1String("mNX"));
never executed: layout = subControlLayout(QLatin1String("mNX"));
0
5532-
5533 int x = 0, width = 0;-
5534 QRenderRule subRule;-
5535 for (int i = 0; i < layout.count()
i < layout.count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
5536 int layoutButton = layout[i].toInt();-
5537 if (layoutButton < PseudoElement_MdiCloseButton
layoutButton <...MdiCloseButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
5538 || layoutButton > PseudoElement_MdiNormalButton
layoutButton >...diNormalButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
5539 continue;
never executed: continue;
0
5540 QStyle::SubControl control = knownPseudoElements[layoutButton].subControl;-
5541 if (!(opt->subControls & control)
!(opt->subControls & control)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5542 continue;
never executed: continue;
0
5543 subRule = renderRule(w, opt, layoutButton);-
5544 width = subRule.size().width();-
5545 if (sc == control
sc == controlDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
5546 break;
never executed: break;
0
5547 x += width;-
5548 }
never executed: end of block
0
5549-
5550 return
never executed: return subRule.borderRect(QRect(x, opt->rect.top(), width, opt->rect.height()));
subRule.borderRect(QRect(x, opt->rect.top(), width, opt->rect.height()));
never executed: return subRule.borderRect(QRect(x, opt->rect.top(), width, opt->rect.height()));
0
5551 }-
5552 break;
never executed: break;
0
5553-
5554 case
never executed: case CC_TitleBar:
CC_TitleBar:
never executed: case CC_TitleBar:
0
5555 if (const
const QStyleOp...tleBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)
const QStyleOp...tleBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5556 QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar);-
5557 if (!subRule.hasDrawable()
!subRule.hasDrawable()Description
TRUEnever evaluated
FALSEnever evaluated
&& !subRule.hasBox()
!subRule.hasBox()Description
TRUEnever evaluated
FALSEnever evaluated
&& !subRule.hasBorder()
!subRule.hasBorder()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5558 break;
never executed: break;
0
5559 QHash<QStyle::SubControl, QRect> layoutRects = titleBarLayout(w, tb);-
5560 return
never executed: return layoutRects.value(sc);
layoutRects.value(sc);
never executed: return layoutRects.value(sc);
0
5561 }-
5562 break;
never executed: break;
0
5563-
5564 default
never executed: default:
:
never executed: default:
0
5565 break;
never executed: break;
0
5566 }-
5567-
5568 return
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
baseStyle()->subControlRect(cc, opt, sc, w);
never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
0
5569}-
5570-
5571QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, const QWidget *w) const-
5572{-
5573 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return baseStyle()->subElementRect(se, opt, w); } QStyleSheetStyleRecursionGuard recursion_guard(this);-
5574-
5575 QRenderRule rule = renderRule(w, opt);-
5576-
5577 int pe = PseudoElement_None;-
5578-
5579-
5580 switch (se) {-
5581 case SE_PushButtonContents:-
5582 case SE_PushButtonFocusRect:-
5583 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {-
5584 QStyleOptionButton btnOpt(*btn);-
5585 if (rule.hasBox() || !rule.hasNativeBorder())-
5586 return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect));-
5587 return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, &btnOpt, w)-
5588 : QWindowsStyle::subElementRect(se, &btnOpt, w);-
5589 }-
5590 break;-
5591-
5592 case SE_LineEditContents:-
5593 case SE_FrameContents:-
5594 case SE_ShapedFrameContents:-
5595 if (rule.hasBox() || !rule.hasNativeBorder()) {-
5596 return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect));-
5597 }-
5598 break;-
5599-
5600 case SE_CheckBoxIndicator:-
5601 case SE_RadioButtonIndicator:-
5602 if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {-
5603 PseudoElement pe = se == SE_CheckBoxIndicator ? PseudoElement_Indicator : PseudoElement_ExclusiveIndicator;-
5604 QRenderRule subRule = renderRule(w, opt, pe);-
5605 return positionRect(w, rule, subRule, pe, opt->rect, opt->direction);-
5606 }-
5607 break;-
5608-
5609 case SE_CheckBoxContents:-
5610 case SE_RadioButtonContents:-
5611 if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {-
5612 bool isRadio = se == SE_RadioButtonContents;-
5613 QRect ir = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator,-
5614 opt, w);-
5615 ir = visualRect(opt->direction, opt->rect, ir);-
5616 int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, 0, w);-
5617 QRect cr = rule.contentsRect(opt->rect);-
5618 ir.setRect(ir.left() + ir.width() + spacing, cr.y(),-
5619 cr.width() - ir.width() - spacing, cr.height());-
5620 return visualRect(opt->direction, opt->rect, ir);-
5621 }-
5622 break;-
5623-
5624 case SE_ToolBoxTabContents:-
5625 if (w && hasStyleRule(w->parentWidget(), PseudoElement_ToolBoxTab)) {-
5626 QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_ToolBoxTab);-
5627 return visualRect(opt->direction, opt->rect, subRule.contentsRect(opt->rect));-
5628 }-
5629 break;-
5630-
5631 case SE_RadioButtonFocusRect:-
5632 case SE_RadioButtonClickRect:-
5633 if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {-
5634 return opt->rect;-
5635 }-
5636 break;-
5637-
5638 case SE_CheckBoxFocusRect:-
5639 case SE_CheckBoxClickRect:-
5640 return ParentStyle::subElementRect(se, opt, w);-
5641-
5642-
5643 case SE_ViewItemCheckIndicator:-
5644 if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {-
5645 return subElementRect(SE_CheckBoxIndicator, opt, w);-
5646 }-
5647-
5648 case SE_ItemViewItemText:-
5649 case SE_ItemViewItemDecoration:-
5650 case SE_ItemViewItemFocusRect:-
5651 if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {-
5652 QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);-
5653 PseudoElement pe = PseudoElement_None;-
5654 if (se == SE_ItemViewItemText || se == SE_ItemViewItemFocusRect)-
5655 pe = PseudoElement_ViewItemText;-
5656 else if (se == SE_ItemViewItemDecoration && vopt->features & QStyleOptionViewItem::HasDecoration)-
5657 pe = PseudoElement_ViewItemIcon;-
5658 else if (se == SE_ItemViewItemCheckIndicator && vopt->features & QStyleOptionViewItem::HasCheckIndicator)-
5659 pe = PseudoElement_ViewItemIndicator;-
5660 else-
5661 break;-
5662 if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || hasStyleRule(w, pe)) {-
5663 QRenderRule subRule2 = renderRule(w, opt, pe);-
5664 QStyleOptionViewItem optCopy(*vopt);-
5665 optCopy.rect = subRule.contentsRect(vopt->rect);-
5666 QRect rect = ParentStyle::subElementRect(se, &optCopy, w);-
5667 return positionRect(w, subRule2, pe, rect, opt->direction);-
5668 }-
5669 }-
5670 break;-
5671-
5672-
5673 case SE_HeaderArrow: {-
5674 QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewUpArrow);-
5675 if (subRule.hasPosition() || subRule.hasGeometry())-
5676 return positionRect(w, rule, subRule, PseudoElement_HeaderViewUpArrow, opt->rect, opt->direction);-
5677 }-
5678 break;-
5679-
5680 case SE_HeaderLabel: {-
5681 QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);-
5682 if (subRule.hasBox() || !subRule.hasNativeBorder())-
5683 return subRule.contentsRect(opt->rect);-
5684 }-
5685 break;-
5686-
5687 case SE_ProgressBarGroove:-
5688 case SE_ProgressBarContents:-
5689 case SE_ProgressBarLabel:-
5690 if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {-
5691 if (rule.hasBox() || !rule.hasNativeBorder() || rule.hasPosition() || hasStyleRule(w, PseudoElement_ProgressBarChunk)) {-
5692 if (se == SE_ProgressBarGroove)-
5693 return rule.borderRect(pb->rect);-
5694 else if (se == SE_ProgressBarContents)-
5695 return rule.contentsRect(pb->rect);-
5696-
5697 QSize sz = pb->fontMetrics.size(0, pb->text);-
5698 return QStyle::alignedRect(Qt::LeftToRight, rule.hasPosition() ? rule.position()->textAlignment : pb->textAlignment,-
5699 sz, pb->rect);-
5700 }-
5701 }-
5702 break;-
5703-
5704-
5705 case SE_TabWidgetLeftCorner:-
5706 pe = PseudoElement_TabWidgetLeftCorner;-
5707-
5708 case SE_TabWidgetRightCorner:-
5709 if (pe == PseudoElement_None)-
5710 pe = PseudoElement_TabWidgetRightCorner;-
5711-
5712 case SE_TabWidgetTabBar:-
5713 if (pe == PseudoElement_None)-
5714 pe = PseudoElement_TabWidgetTabBar;-
5715-
5716 case SE_TabWidgetTabPane:-
5717 case SE_TabWidgetTabContents:-
5718 if (pe == PseudoElement_None)-
5719 pe = PseudoElement_TabWidgetPane;-
5720-
5721 if (hasStyleRule(w, pe)) {-
5722 QRect r = QWindowsStyle::subElementRect(pe == PseudoElement_TabWidgetPane ? SE_TabWidgetTabPane : se, opt, w);-
5723 QRenderRule subRule = renderRule(w, opt, pe);-
5724 r = positionRect(w, subRule, pe, r, opt->direction);-
5725 if (pe == PseudoElement_TabWidgetTabBar) {-
5726 ((!(opt)) ? qt_assert("opt",__FILE__,57585823) : qt_noop());-
5727 r = opt->rect.intersected(r);-
5728 }-
5729 if (se == SE_TabWidgetTabContents)-
5730 r = subRule.contentsRect(r);-
5731 return r;-
5732 }-
5733 break;-
5734-
5735 case SE_TabBarTearIndicator: {-
5736 QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTear);-
5737 if (subRule.hasContentsSize()) {-
5738 QRect r;-
5739 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {-
5740 switch (tab->shape) {-
5741 case QTabBar::RoundedNorth:-
5742 case QTabBar::TriangularNorth:-
5743 case QTabBar::RoundedSouth:-
5744 case QTabBar::TriangularSouth:-
5745 r.setRect(tab->rect.left(), tab->rect.top(), subRule.size().width(), opt->rect.height());-
5746 break;-
5747 case QTabBar::RoundedWest:-
5748 case QTabBar::TriangularWest:-
5749 case QTabBar::RoundedEast:-
5750 case QTabBar::TriangularEast:-
5751 r.setRect(tab->rect.left(), tab->rect.top(), opt->rect.width(), subRule.size().height());-
5752 break;-
5753 default:-
5754 break;-
5755 }-
5756 r = visualRect(opt->direction, opt->rect, r);-
5757 }-
5758 return r;-
5759 }-
5760 break;-
5761 }-
5762 case SE_TabBarTabText:-
5763 case SE_TabBarTabLeftButton:-
5764 case SE_TabBarTabRightButton: {-
5765 QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);-
5766 if (subRule.hasBox() || !subRule.hasNativeBorder()) {-
5767 return ParentStyle::subElementRect(se, opt, w);-
5768 }-
5769 break;-
5770 }-
5771-
5772-
5773 case SE_DockWidgetCloseButton:-
5774 case SE_DockWidgetFloatButton: {-
5775 PseudoElement pe = (se == SE_DockWidgetCloseButton) ? PseudoElement_DockWidgetCloseButton : PseudoElement_DockWidgetFloatButton;-
5776 QRenderRule subRule2 = renderRule(w, opt, pe);-
5777 if (!subRule2.hasPosition())-
5778 break;-
5779 QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetTitle);-
5780 return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction);-
5781 }-
5782-
5783-
5784 case SE_ToolBarHandle:-
5785 if (hasStyleRule(w, PseudoElement_ToolBarHandle))-
5786 return ParentStyle::subElementRect(se, opt, w);-
5787 break;-
5788-
5789-
5790-
5791-
5792 case SE_CheckBoxLayoutItem:-
5793 case SE_ComboBoxLayoutItem:-
5794 case SE_DateTimeEditLayoutItem:-
5795 case SE_LabelLayoutItem:-
5796 case SE_ProgressBarLayoutItem:-
5797 case SE_PushButtonLayoutItem:-
5798 case SE_RadioButtonLayoutItem:-
5799 case SE_SliderLayoutItem:-
5800 case SE_SpinBoxLayoutItem:-
5801 case SE_ToolButtonLayoutItem:-
5802 case SE_FrameLayoutItem:-
5803 case SE_GroupBoxLayoutItem:-
5804 case SE_TabWidgetLayoutItem:-
5805 if (!rule.hasNativeBorder())-
5806 return opt->rect;-
5807 break;-
5808-
5809 default:-
5810 break;-
5811 }-
5812-
5813 return baseStyle()->subElementRect(se, opt, w);-
5814}-
5815-
5816bool QStyleSheetStyle::event(QEvent *e)-
5817{-
5818 return (baseStyle()->event(e) && e->isAccepted()) || ParentStyle::event(e);-
5819}-
5820-
5821void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const-
5822{-
5823-
5824-
5825 if (w->objectName() == QLatin1String("qt_fontDialog_sampleEdit")
w->objectName(...g_sampleEdit")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5826 return;
never executed: return;
0
5827-
5828 QWidget *container = containerWidget(w);-
5829 QRenderRule rule = renderRule(container, PseudoElement_None,-
5830 PseudoClass_Active | PseudoClass_Enabled | extendedPseudoClass(container));-
5831-
5832 const bool useStyleSheetPropagationInWidgetStyles =-
5833 QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);-
5834-
5835 if (useStyleSheetPropagationInWidgetStyles
useStyleSheetP...InWidgetStylesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
5836 unsetStyleSheetFont(w);-
5837-
5838 if (rule.font.resolve()
rule.font.resolve()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5839 QFont wf = w->font();-
5840 styleSheetCaches->customFontWidgets.insert(w, qMakePair(wf, rule.font.resolve()));-
5841-
5842 QFont font = rule.font.resolve(wf);-
5843 font.resolve(wf.resolve() | rule.font.resolve());-
5844 w->setFont(font);-
5845 }
never executed: end of block
0
5846 }
never executed: end of block
else {
0
5847 QFont font = rule.font.resolve(w->font());-
5848-
5849 if ((!w->isWindow()
!w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| w->testAttribute(Qt::WA_WindowPropagation)
w->testAttribu...owPropagation)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
5850 && isNaturalChild(w)
isNaturalChild(w)Description
TRUEnever evaluated
FALSEnever evaluated
&& qobject_cast<QWidget *>(w->parent())
qobject_cast<Q...>(w->parent())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
5851-
5852 font = font.resolve(static_cast<QWidget *>(w->parent())->font());-
5853 }
never executed: end of block
0
5854-
5855 if (w->data->fnt == font
w->data->fnt == fontDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
5856 return;
never executed: return;
0
5857-
5858 w->data->fnt = font;-
5859-
5860 QEvent e(QEvent::FontChange);-
5861 QApplication::sendEvent(w, &e);-
5862 }
never executed: end of block
0
5863}-
5864-
5865void QStyleSheetStyle::saveWidgetFont(QWidget* w, const QFont& font) const-
5866{-
5867 w->setProperty("_q_styleSheetWidgetFont", font);-
5868}-
5869-
5870void QStyleSheetStyle::clearWidgetFont(QWidget* w) const-
5871{-
5872 w->setProperty("_q_styleSheetWidgetFont", QVariant(QVariant::Invalid));-
5873}-
5874-
5875-
5876-
5877-
5878-
5879bool QStyleSheetStyle::styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)-
5880{-
5881 if (!w || !opt || !pal)-
5882 return false;-
5883-
5884 if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { return false; } QStyleSheetStyleRecursionGuard recursion_guard(this);-
5885-
5886 w = containerWidget(w);-
5887-
5888 QRenderRule rule = renderRule(w, PseudoElement_None, pseudoClass(opt->state) | extendedPseudoClass(w));-
5889 if (!rule.hasPalette())-
5890 return false;-
5891-
5892 rule.configurePalette(pal, QPalette::NoRole, QPalette::NoRole);-
5893 return true;-
5894}-
5895-
5896Qt::Alignment QStyleSheetStyle::resolveAlignment(Qt::LayoutDirection layDir, Qt::Alignment src)-
5897{-
5898 if (layDir == Qt::LeftToRight || src & Qt::AlignAbsolute)-
5899 return src;-
5900-
5901 if (src & Qt::AlignLeft) {-
5902 src &= ~Qt::AlignLeft;-
5903 src |= Qt::AlignRight;-
5904 } else if (src & Qt::AlignRight) {-
5905 src &= ~Qt::AlignRight;-
5906 src |= Qt::AlignLeft;-
5907 }-
5908 src |= Qt::AlignAbsolute;-
5909 return src;-
5910}-
5911-
5912-
5913-
5914-
5915-
5916-
5917-
5918bool QStyleSheetStyle::isNaturalChild(const QObject *obj)-
5919{-
5920 if (obj->objectName().startsWith(QLatin1String("qt_")))-
5921 return true;-
5922-
5923 return false;-
5924}-
5925-
5926-
5927-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9