qcssutil.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qcssutil.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6using namespace QCss;-
7-
8static QPen qPenFromStyle(const QBrush& b, qreal width, BorderStyle s)-
9{-
10 Qt::PenStyle ps = Qt::NoPen;-
11-
12 switch (s) {-
13 case
never executed: case BorderStyle_Dotted:
BorderStyle_Dotted:
never executed: case BorderStyle_Dotted:
0
14 ps = Qt::DotLine;-
15 break;
never executed: break;
0
16 case
never executed: case BorderStyle_Dashed:
BorderStyle_Dashed:
never executed: case BorderStyle_Dashed:
0
17 ps = width == 1
width == 1Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::DotLine : Qt::DashLine;
0
18 break;
never executed: break;
0
19 case
never executed: case BorderStyle_DotDash:
BorderStyle_DotDash:
never executed: case BorderStyle_DotDash:
0
20 ps = Qt::DashDotLine;-
21 break;
never executed: break;
0
22 case
never executed: case BorderStyle_DotDotDash:
BorderStyle_DotDotDash:
never executed: case BorderStyle_DotDotDash:
0
23 ps = Qt::DashDotDotLine;-
24 break;
never executed: break;
0
25 case
never executed: case BorderStyle_Inset:
BorderStyle_Inset:
never executed: case BorderStyle_Inset:
0
26 case
never executed: case BorderStyle_Outset:
BorderStyle_Outset:
never executed: case BorderStyle_Outset:
0
27 case
never executed: case BorderStyle_Solid:
BorderStyle_Solid:
never executed: case BorderStyle_Solid:
0
28 ps = Qt::SolidLine;-
29 break;
never executed: break;
0
30 default
never executed: default:
:
never executed: default:
0
31 break;
never executed: break;
0
32 }-
33-
34 return
never executed: return QPen(b, width, ps, Qt::FlatCap);
QPen(b, width, ps, Qt::FlatCap);
never executed: return QPen(b, width, ps, Qt::FlatCap);
0
35}-
36-
37void qDrawRoundedCorners(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2,-
38 const QSizeF& r1, const QSizeF& r2,-
39 Edge edge, BorderStyle s, QBrush c)-
40{-
41 const qreal pw = (edge == TopEdge
edge == TopEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == BottomEdge
edge == BottomEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
) ? y2-y1 : x2-x1;
0
42 if (s == BorderStyle_Double
s == BorderStyle_DoubleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
43 qreal wby3 = pw/3;-
44 switch (edge) {-
45 case
never executed: case TopEdge:
TopEdge:
never executed: case TopEdge:
0
46 case
never executed: case BottomEdge:
BottomEdge:
never executed: case BottomEdge:
0
47 qDrawRoundedCorners(p, x1, y1, x2, y1+wby3, r1, r2, edge, BorderStyle_Solid, c);-
48 qDrawRoundedCorners(p, x1, y2-wby3, x2, y2, r1, r2, edge, BorderStyle_Solid, c);-
49 break;
never executed: break;
0
50 case
never executed: case LeftEdge:
LeftEdge:
never executed: case LeftEdge:
0
51 qDrawRoundedCorners(p, x1, y1+1, x1+wby3, y2, r1, r2, LeftEdge, BorderStyle_Solid, c);-
52 qDrawRoundedCorners(p, x2-wby3, y1+1, x2, y2, r1, r2, LeftEdge, BorderStyle_Solid, c);-
53 break;
never executed: break;
0
54 case
never executed: case RightEdge:
RightEdge:
never executed: case RightEdge:
0
55 qDrawRoundedCorners(p, x1, y1+1, x1+wby3, y2, r1, r2, RightEdge, BorderStyle_Solid, c);-
56 qDrawRoundedCorners(p, x2-wby3, y1+1, x2, y2, r1, r2, RightEdge, BorderStyle_Solid, c);-
57 break;
never executed: break;
0
58 default
never executed: default:
:
never executed: default:
0
59 break;
never executed: break;
0
60 }-
61 return;
never executed: return;
0
62 } else if (s == BorderStyle_Ridge
s == BorderStyle_RidgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| s == BorderStyle_Groove
s == BorderStyle_GrooveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
63 BorderStyle s1, s2;-
64 if (s == BorderStyle_Groove
s == BorderStyle_GrooveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
65 s1 = BorderStyle_Inset;-
66 s2 = BorderStyle_Outset;-
67 }
never executed: end of block
else {
0
68 s1 = BorderStyle_Outset;-
69 s2 = BorderStyle_Inset;-
70 }
never executed: end of block
0
71 int pwby2 = qRound(pw/2);-
72 switch (edge) {-
73 case
never executed: case TopEdge:
TopEdge:
never executed: case TopEdge:
0
74 qDrawRoundedCorners(p, x1, y1, x2, y1 + pwby2, r1, r2, TopEdge, s1, c);-
75 qDrawRoundedCorners(p, x1, y1 + pwby2, x2, y2, r1, r2, TopEdge, s2, c);-
76 break;
never executed: break;
0
77 case
never executed: case BottomEdge:
BottomEdge:
never executed: case BottomEdge:
0
78 qDrawRoundedCorners(p, x1, y1 + pwby2, x2, y2, r1, r2, BottomEdge, s1, c);-
79 qDrawRoundedCorners(p, x1, y1, x2, y2-pwby2, r1, r2, BottomEdge, s2, c);-
80 break;
never executed: break;
0
81 case
never executed: case LeftEdge:
LeftEdge:
never executed: case LeftEdge:
0
82 qDrawRoundedCorners(p, x1, y1, x1 + pwby2, y2, r1, r2, LeftEdge, s1, c);-
83 qDrawRoundedCorners(p, x1 + pwby2, y1, x2, y2, r1, r2, LeftEdge, s2, c);-
84 break;
never executed: break;
0
85 case
never executed: case RightEdge:
RightEdge:
never executed: case RightEdge:
0
86 qDrawRoundedCorners(p, x1 + pwby2, y1, x2, y2, r1, r2, RightEdge, s1, c);-
87 qDrawRoundedCorners(p, x1, y1, x2 - pwby2, y2, r1, r2, RightEdge, s2, c);-
88 break;
never executed: break;
0
89 default
never executed: default:
:
never executed: default:
0
90 break;
never executed: break;
0
91 }-
92 } else if ((s == BorderStyle_Outset
s == BorderStyle_OutsetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (edge == TopEdge
edge == TopEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == LeftEdge
edge == LeftEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
93 || (s == BorderStyle_Inset
s == BorderStyle_InsetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (edge == BottomEdge
edge == BottomEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == RightEdge
edge == RightEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
)))
0
94 c = c.color().lighter();
never executed: c = c.color().lighter();
0
95-
96 p->save();-
97 qreal pwby2 = pw/2;-
98 p->setBrush(Qt::NoBrush);-
99 QPen pen = qPenFromStyle(c, pw, s);-
100 pen.setCapStyle(Qt::SquareCap);-
101 p->setPen(pen);-
102 switch (edge) {-
103 case
never executed: case TopEdge:
TopEdge:
never executed: case TopEdge:
0
104 if (!r1.isEmpty()
!r1.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
105 p->drawArc(QRectF(x1 - r1.width() + pwby2, y1 + pwby2,
never executed: p->drawArc(QRectF(x1 - r1.width() + pwby2, y1 + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), 135*16, -45*16);
0
106 2*r1.width() - pw, 2*r1.height() - pw), 135*16, -45*16);
never executed: p->drawArc(QRectF(x1 - r1.width() + pwby2, y1 + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), 135*16, -45*16);
0
107 if (!r2.isEmpty()
!r2.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
108 p->drawArc(QRectF(x2 - r2.width() + pwby2, y1 + pwby2,
never executed: p->drawArc(QRectF(x2 - r2.width() + pwby2, y1 + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), 45*16, 45*16);
0
109 2*r2.width() - pw, 2*r2.height() - pw), 45*16, 45*16);
never executed: p->drawArc(QRectF(x2 - r2.width() + pwby2, y1 + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), 45*16, 45*16);
0
110 break;
never executed: break;
0
111 case
never executed: case BottomEdge:
BottomEdge:
never executed: case BottomEdge:
0
112 if (!r1.isEmpty()
!r1.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
113 p->drawArc(QRectF(x1 - r1.width() + pwby2, y2 - 2*r1.height() + pwby2,
never executed: p->drawArc(QRectF(x1 - r1.width() + pwby2, y2 - 2*r1.height() + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), -90 * 16, -45 * 16);
0
114 2*r1.width() - pw, 2*r1.height() - pw), -90 * 16, -45 * 16);
never executed: p->drawArc(QRectF(x1 - r1.width() + pwby2, y2 - 2*r1.height() + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), -90 * 16, -45 * 16);
0
115 if (!r2.isEmpty()
!r2.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
116 p->drawArc(QRectF(x2 - r2.width() + pwby2, y2 - 2*r2.height() + pwby2,
never executed: p->drawArc(QRectF(x2 - r2.width() + pwby2, y2 - 2*r2.height() + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), -90 * 16, 45 * 16);
0
117 2*r2.width() - pw, 2*r2.height() - pw), -90 * 16, 45 * 16);
never executed: p->drawArc(QRectF(x2 - r2.width() + pwby2, y2 - 2*r2.height() + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), -90 * 16, 45 * 16);
0
118 break;
never executed: break;
0
119 case
never executed: case LeftEdge:
LeftEdge:
never executed: case LeftEdge:
0
120 if (!r1.isEmpty()
!r1.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
121 p->drawArc(QRectF(x1 + pwby2, y1 - r1.height() + pwby2,
never executed: p->drawArc(QRectF(x1 + pwby2, y1 - r1.height() + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), 135*16, 45*16);
0
122 2*r1.width() - pw, 2*r1.height() - pw), 135*16, 45*16);
never executed: p->drawArc(QRectF(x1 + pwby2, y1 - r1.height() + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), 135*16, 45*16);
0
123 if (!r2.isEmpty()
!r2.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
124 p->drawArc(QRectF(x1 + pwby2, y2 - r2.height() + pwby2,
never executed: p->drawArc(QRectF(x1 + pwby2, y2 - r2.height() + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), 180*16, 45*16);
0
125 2*r2.width() - pw, 2*r2.height() - pw), 180*16, 45*16);
never executed: p->drawArc(QRectF(x1 + pwby2, y2 - r2.height() + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), 180*16, 45*16);
0
126 break;
never executed: break;
0
127 case
never executed: case RightEdge:
RightEdge:
never executed: case RightEdge:
0
128 if (!r1.isEmpty()
!r1.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
129 p->drawArc(QRectF(x2 - 2*r1.width() + pwby2, y1 - r1.height() + pwby2,
never executed: p->drawArc(QRectF(x2 - 2*r1.width() + pwby2, y1 - r1.height() + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), 45*16, -45*16);
0
130 2*r1.width() - pw, 2*r1.height() - pw), 45*16, -45*16);
never executed: p->drawArc(QRectF(x2 - 2*r1.width() + pwby2, y1 - r1.height() + pwby2, 2*r1.width() - pw, 2*r1.height() - pw), 45*16, -45*16);
0
131 if (!r2.isEmpty()
!r2.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
132 p->drawArc(QRectF(x2 - 2*r2.width() + pwby2, y2 - r2.height() + pwby2,
never executed: p->drawArc(QRectF(x2 - 2*r2.width() + pwby2, y2 - r2.height() + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), 315*16, 45*16);
0
133 2*r2.width() - pw, 2*r2.height() - pw), 315*16, 45*16);
never executed: p->drawArc(QRectF(x2 - 2*r2.width() + pwby2, y2 - r2.height() + pwby2, 2*r2.width() - pw, 2*r2.height() - pw), 315*16, 45*16);
0
134 break;
never executed: break;
0
135 default
never executed: default:
:
never executed: default:
0
136 break;
never executed: break;
0
137 }-
138 p->restore();-
139}
never executed: end of block
0
140-
141-
142void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, qreal dw2,-
143 QCss::Edge edge, QCss::BorderStyle style, QBrush c)-
144{-
145 p->save();-
146 const qreal width = (edge == TopEdge
edge == TopEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == BottomEdge
edge == BottomEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
) ? (y2-y1) : (x2-x1);
0
147-
148 if (width <= 2
width <= 2Description
TRUEnever evaluated
FALSEnever evaluated
&& style == BorderStyle_Double
style == BorderStyle_DoubleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
149 style = BorderStyle_Solid;
never executed: style = BorderStyle_Solid;
0
150-
151 switch (style) {-
152 case
never executed: case BorderStyle_Inset:
BorderStyle_Inset:
never executed: case BorderStyle_Inset:
0
153 case
never executed: case BorderStyle_Outset:
BorderStyle_Outset:
never executed: case BorderStyle_Outset:
0
154 if ((style == BorderStyle_Outset
style == BorderStyle_OutsetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (edge == TopEdge
edge == TopEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == LeftEdge
edge == LeftEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
155 || (style == BorderStyle_Inset
style == BorderStyle_InsetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (edge == BottomEdge
edge == BottomEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == RightEdge
edge == RightEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
)))
0
156 c = c.color().lighter();
never executed: c = c.color().lighter();
0
157-
158 case
never executed: case BorderStyle_Solid:
BorderStyle_Solid:
never executed: case BorderStyle_Solid:
code before this statement never executed: case BorderStyle_Solid:
{
0
159 p->setPen(Qt::NoPen);-
160 p->setBrush(c);-
161 if (width == 1
width == 1Description
TRUEnever evaluated
FALSEnever evaluated
|| (dw1 == 0
dw1 == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& dw2 == 0
dw2 == 0Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
162 p->drawRect(QRectF(x1, y1, x2-x1, y2-y1));-
163 }
never executed: end of block
else {
0
164 QPolygonF quad;-
165 switch (edge) {-
166 case
never executed: case TopEdge:
TopEdge:
never executed: case TopEdge:
0
167 quad << QPointF(x1, y1) << QPointF(x1 + dw1, y2)-
168 << QPointF(x2 - dw2, y2) << QPointF(x2, y1);-
169 break;
never executed: break;
0
170 case
never executed: case BottomEdge:
BottomEdge:
never executed: case BottomEdge:
0
171 quad << QPointF(x1 + dw1, y1) << QPointF(x1, y2)-
172 << QPointF(x2, y2) << QPointF(x2 - dw2, y1);-
173 break;
never executed: break;
0
174 case
never executed: case LeftEdge:
LeftEdge:
never executed: case LeftEdge:
0
175 quad << QPointF(x1, y1) << QPointF(x1, y2)-
176 << QPointF(x2, y2 - dw2) << QPointF(x2, y1 + dw1);-
177 break;
never executed: break;
0
178 case
never executed: case RightEdge:
RightEdge:
never executed: case RightEdge:
0
179 quad << QPointF(x1, y1 + dw1) << QPointF(x1, y2 - dw2)-
180 << QPointF(x2, y2) << QPointF(x2, y1);-
181 break;
never executed: break;
0
182 default
never executed: default:
:
never executed: default:
0
183 break;
never executed: break;
0
184 }-
185 p->drawConvexPolygon(quad);-
186 }
never executed: end of block
0
187 break;
never executed: break;
0
188 }-
189 case
never executed: case BorderStyle_Dotted:
BorderStyle_Dotted:
never executed: case BorderStyle_Dotted:
0
190 case
never executed: case BorderStyle_Dashed:
BorderStyle_Dashed:
never executed: case BorderStyle_Dashed:
0
191 case
never executed: case BorderStyle_DotDash:
BorderStyle_DotDash:
never executed: case BorderStyle_DotDash:
0
192 case
never executed: case BorderStyle_DotDotDash:
BorderStyle_DotDotDash:
never executed: case BorderStyle_DotDotDash:
0
193 p->setPen(qPenFromStyle(c, width, style));-
194 if (width == 1
width == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
195 p->drawLine(QLineF(x1, y1, x2 - 1, y2 - 1));
never executed: p->drawLine(QLineF(x1, y1, x2 - 1, y2 - 1));
0
196 else if (edge == TopEdge
edge == TopEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
|| edge == BottomEdge
edge == BottomEdgeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
197 p->drawLine(QLineF(x1 + width/2, (y1 + y2)/2, x2 - width/2, (y1 + y2)/2));
never executed: p->drawLine(QLineF(x1 + width/2, (y1 + y2)/2, x2 - width/2, (y1 + y2)/2));
0
198 else-
199 p->drawLine(QLineF((x1+x2)/2, y1 + width/2, (x1+x2)/2, y2 - width/2));
never executed: p->drawLine(QLineF((x1+x2)/2, y1 + width/2, (x1+x2)/2, y2 - width/2));
0
200 break;
never executed: break;
0
201-
202 case
never executed: case BorderStyle_Double:
BorderStyle_Double:
never executed: case BorderStyle_Double:
{
0
203 int wby3 = qRound(width/3);-
204 int dw1by3 = qRound(dw1/3);-
205 int dw2by3 = qRound(dw2/3);-
206 switch (edge) {-
207 case
never executed: case TopEdge:
TopEdge:
never executed: case TopEdge:
0
208 qDrawEdge(p, x1, y1, x2, y1 + wby3, dw1by3, dw2by3, TopEdge, BorderStyle_Solid, c);-
209 qDrawEdge(p, x1 + dw1 - dw1by3, y2 - wby3, x2 - dw2 + dw1by3, y2,-
210 dw1by3, dw2by3, TopEdge, BorderStyle_Solid, c);-
211 break;
never executed: break;
0
212 case
never executed: case LeftEdge:
LeftEdge:
never executed: case LeftEdge:
0
213 qDrawEdge(p, x1, y1, x1 + wby3, y2, dw1by3, dw2by3, LeftEdge, BorderStyle_Solid, c);-
214 qDrawEdge(p, x2 - wby3, y1 + dw1 - dw1by3, x2, y2 - dw2 + dw2by3, dw1by3, dw2by3,-
215 LeftEdge, BorderStyle_Solid, c);-
216 break;
never executed: break;
0
217 case
never executed: case BottomEdge:
BottomEdge:
never executed: case BottomEdge:
0
218 qDrawEdge(p, x1 + dw1 - dw1by3, y1, x2 - dw2 + dw2by3, y1 + wby3, dw1by3, dw2by3,-
219 BottomEdge, BorderStyle_Solid, c);-
220 qDrawEdge(p, x1, y2 - wby3, x2, y2, dw1by3, dw2by3, BottomEdge, BorderStyle_Solid, c);-
221 break;
never executed: break;
0
222 case
never executed: case RightEdge:
RightEdge:
never executed: case RightEdge:
0
223 qDrawEdge(p, x2 - wby3, y1, x2, y2, dw1by3, dw2by3, RightEdge, BorderStyle_Solid, c);-
224 qDrawEdge(p, x1, y1 + dw1 - dw1by3, x1 + wby3, y2 - dw2 + dw2by3, dw1by3, dw2by3,-
225 RightEdge, BorderStyle_Solid, c);-
226 break;
never executed: break;
0
227 default
never executed: default:
:
never executed: default:
0
228 break;
never executed: break;
0
229 }-
230 break;
never executed: break;
0
231 }-
232 case
never executed: case BorderStyle_Ridge:
BorderStyle_Ridge:
never executed: case BorderStyle_Ridge:
0
233 case
never executed: case BorderStyle_Groove:
BorderStyle_Groove:
never executed: case BorderStyle_Groove:
{
0
234 BorderStyle s1, s2;-
235 if (style == BorderStyle_Groove
style == BorderStyle_GrooveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
236 s1 = BorderStyle_Inset;-
237 s2 = BorderStyle_Outset;-
238 }
never executed: end of block
else {
0
239 s1 = BorderStyle_Outset;-
240 s2 = BorderStyle_Inset;-
241 }
never executed: end of block
0
242 int dw1by2 = qFloor(dw1/2), dw2by2 = qFloor(dw2/2);-
243 int wby2 = qRound(width/2);-
244 switch (edge) {-
245 case
never executed: case TopEdge:
TopEdge:
never executed: case TopEdge:
0
246 qDrawEdge(p, x1, y1, x2, y1 + wby2, dw1by2, dw2by2, TopEdge, s1, c);-
247 qDrawEdge(p, x1 + dw1by2, y1 + wby2, x2 - dw2by2, y2, dw1by2, dw2by2, TopEdge, s2, c);-
248 break;
never executed: break;
0
249 case
never executed: case BottomEdge:
BottomEdge:
never executed: case BottomEdge:
0
250 qDrawEdge(p, x1, y1 + wby2, x2, y2, dw1by2, dw2by2, BottomEdge, s1, c);-
251 qDrawEdge(p, x1 + dw1by2, y1, x2 - dw2by2, y1 + wby2, dw1by2, dw2by2, BottomEdge, s2, c);-
252 break;
never executed: break;
0
253 case
never executed: case LeftEdge:
LeftEdge:
never executed: case LeftEdge:
0
254 qDrawEdge(p, x1, y1, x1 + wby2, y2, dw1by2, dw2by2, LeftEdge, s1, c);-
255 qDrawEdge(p, x1 + wby2, y1 + dw1by2, x2, y2 - dw2by2, dw1by2, dw2by2, LeftEdge, s2, c);-
256 break;
never executed: break;
0
257 case
never executed: case RightEdge:
RightEdge:
never executed: case RightEdge:
0
258 qDrawEdge(p, x1 + wby2, y1, x2, y2, dw1by2, dw2by2, RightEdge, s1, c);-
259 qDrawEdge(p, x1, y1 + dw1by2, x1 + wby2, y2 - dw2by2, dw1by2, dw2by2, RightEdge, s2, c);-
260 break;
never executed: break;
0
261 default
never executed: default:
:
never executed: default:
0
262 break;
never executed: break;
0
263 }-
264 }-
265 default
never executed: default:
:
never executed: default:
code before this statement never executed: default:
0
266 break;
never executed: break;
0
267 }-
268 p->restore();-
269}
never executed: end of block
0
270-
271void qNormalizeRadii(const QRect &br, const QSize *radii,-
272 QSize *tlr, QSize *trr, QSize *blr, QSize *brr)-
273{-
274 *tlr = radii[0].expandedTo(QSize(0, 0));-
275 *trr = radii[1].expandedTo(QSize(0, 0));-
276 *blr = radii[2].expandedTo(QSize(0, 0));-
277 *brr = radii[3].expandedTo(QSize(0, 0));-
278 if (tlr->width() + trr->width() > br.width()
tlr->width() +...) > br.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
279 *
never executed: *tlr = *trr = QSize(0, 0);
tlr = *trr = QSize(0, 0);
never executed: *tlr = *trr = QSize(0, 0);
0
280 if (blr->width() + brr->width() > br.width()
blr->width() +...) > br.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
281 *
never executed: *blr = *brr = QSize(0, 0);
blr = *brr = QSize(0, 0);
never executed: *blr = *brr = QSize(0, 0);
0
282 if (tlr->height() + blr->height() > br.height()
tlr->height() ... > br.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
283 *
never executed: *tlr = *blr = QSize(0, 0);
tlr = *blr = QSize(0, 0);
never executed: *tlr = *blr = QSize(0, 0);
0
284 if (trr->height() + brr->height() > br.height()
trr->height() ... > br.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
285 *
never executed: *trr = *brr = QSize(0, 0);
trr = *brr = QSize(0, 0);
never executed: *trr = *brr = QSize(0, 0);
0
286}
never executed: end of block
0
287-
288-
289static bool paintsOver(const QCss::BorderStyle *styles, const QBrush *colors, QCss::Edge e1, QCss::Edge e2)-
290{-
291 QCss::BorderStyle s1 = styles[e1];-
292 QCss::BorderStyle s2 = styles[e2];-
293-
294 if (s2 == BorderStyle_None
s2 == BorderStyle_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
|| colors[e2] == Qt::transparent
colors[e2] == Qt::transparentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
295 return
never executed: return true;
true;
never executed: return true;
0
296-
297 if ((s1 == BorderStyle_Solid
s1 == BorderStyle_SolidDescription
TRUEnever evaluated
FALSEnever evaluated
&& s2 == BorderStyle_Solid
s2 == BorderStyle_SolidDescription
TRUEnever evaluated
FALSEnever evaluated
) && (
(colors[e1] == colors[e2])Description
TRUEnever evaluated
FALSEnever evaluated
colors[e1] == colors[e2])
(colors[e1] == colors[e2])Description
TRUEnever evaluated
FALSEnever evaluated
0
298 && colors[e1].isOpaque()
colors[e1].isOpaque()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
299 return
never executed: return true;
true;
never executed: return true;
0
300 }-
301-
302 return
never executed: return false;
false;
never executed: return false;
0
303}-
304-
305void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles,-
306 const int *borders, const QBrush *colors, const QSize *radii)-
307{-
308 const QRectF br(rect);-
309 QSize tlr, trr, blr, brr;-
310 qNormalizeRadii(rect, radii, &tlr, &trr, &blr, &brr);-
311-
312-
313 if (styles[BottomEdge] != BorderStyle_None
styles[BottomE...rderStyle_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
&& borders[BottomEdge] > 0
borders[BottomEdge] > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
314 qreal dw1 = (blr.width()
blr.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, BottomEdge, LeftEdge)
paintsOver(sty...dge, LeftEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[LeftEdge];
0
315 qreal dw2 = (brr.width()
brr.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, BottomEdge, RightEdge)
paintsOver(sty...ge, RightEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[RightEdge];
0
316 qreal x1 = br.x() + blr.width();-
317 qreal y1 = br.y() + br.height() - borders[BottomEdge];-
318 qreal x2 = br.x() + br.width() - brr.width();-
319 qreal y2 = br.y() + br.height() ;-
320-
321 qDrawEdge(p, x1, y1, x2, y2, dw1, dw2, BottomEdge, styles[BottomEdge], colors[BottomEdge]);-
322 if (blr.width()
blr.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| brr.width()
brr.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
323 qDrawRoundedCorners(p, x1, y1, x2, y2, blr, brr, BottomEdge, styles[BottomEdge], colors[BottomEdge]);
never executed: qDrawRoundedCorners(p, x1, y1, x2, y2, blr, brr, BottomEdge, styles[BottomEdge], colors[BottomEdge]);
0
324 }
never executed: end of block
0
325 if (styles[RightEdge] != BorderStyle_None
styles[RightEd...rderStyle_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
&& borders[RightEdge] > 0
borders[RightEdge] > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
326 qreal dw1 = (trr.height()
trr.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, RightEdge, TopEdge)
paintsOver(sty...Edge, TopEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[TopEdge];
0
327 qreal dw2 = (brr.height()
brr.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, RightEdge, BottomEdge)
paintsOver(sty...e, BottomEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[BottomEdge];
0
328 qreal x1 = br.x() + br.width() - borders[RightEdge];-
329 qreal y1 = br.y() + trr.height();-
330 qreal x2 = br.x() + br.width();-
331 qreal y2 = br.y() + br.height() - brr.height();-
332-
333 qDrawEdge(p, x1, y1, x2, y2, dw1, dw2, RightEdge, styles[RightEdge], colors[RightEdge]);-
334 if (trr.height()
trr.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| brr.height()
brr.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
335 qDrawRoundedCorners(p, x1, y1, x2, y2, trr, brr, RightEdge, styles[RightEdge], colors[RightEdge]);
never executed: qDrawRoundedCorners(p, x1, y1, x2, y2, trr, brr, RightEdge, styles[RightEdge], colors[RightEdge]);
0
336 }
never executed: end of block
0
337 if (styles[LeftEdge] != BorderStyle_None
styles[LeftEdg...rderStyle_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
&& borders[LeftEdge] > 0
borders[LeftEdge] > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
338 qreal dw1 = (tlr.height()
tlr.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, LeftEdge, TopEdge)
paintsOver(sty...Edge, TopEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[TopEdge];
0
339 qreal dw2 = (blr.height()
blr.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, LeftEdge, BottomEdge)
paintsOver(sty...e, BottomEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[BottomEdge];
0
340 qreal x1 = br.x();-
341 qreal y1 = br.y() + tlr.height();-
342 qreal x2 = br.x() + borders[LeftEdge];-
343 qreal y2 = br.y() + br.height() - blr.height();-
344-
345 qDrawEdge(p, x1, y1, x2, y2, dw1, dw2, LeftEdge, styles[LeftEdge], colors[LeftEdge]);-
346 if (tlr.height()
tlr.height()Description
TRUEnever evaluated
FALSEnever evaluated
|| blr.height()
blr.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
347 qDrawRoundedCorners(p, x1, y1, x2, y2, tlr, blr, LeftEdge, styles[LeftEdge], colors[LeftEdge]);
never executed: qDrawRoundedCorners(p, x1, y1, x2, y2, tlr, blr, LeftEdge, styles[LeftEdge], colors[LeftEdge]);
0
348 }
never executed: end of block
0
349 if (styles[TopEdge] != BorderStyle_None
styles[TopEdge...rderStyle_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
&& borders[TopEdge] > 0
borders[TopEdge] > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
350 qreal dw1 = (tlr.width()
tlr.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, TopEdge, LeftEdge)
paintsOver(sty...dge, LeftEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[LeftEdge];
0
351 qreal dw2 = (trr.width()
trr.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| paintsOver(styles, colors, TopEdge, RightEdge)
paintsOver(sty...ge, RightEdge)Description
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : borders[RightEdge];
0
352 qreal x1 = br.x() + tlr.width();-
353 qreal y1 = br.y();-
354 qreal x2 = br.left() + br.width() - trr.width();-
355 qreal y2 = br.y() + borders[TopEdge];-
356-
357 qDrawEdge(p, x1, y1, x2, y2, dw1, dw2, TopEdge, styles[TopEdge], colors[TopEdge]);-
358 if (tlr.width()
tlr.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| trr.width()
trr.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
359 qDrawRoundedCorners(p, x1, y1, x2, y2, tlr, trr, TopEdge, styles[TopEdge], colors[TopEdge]);
never executed: qDrawRoundedCorners(p, x1, y1, x2, y2, tlr, trr, TopEdge, styles[TopEdge], colors[TopEdge]);
0
360 }
never executed: end of block
0
361}
never executed: end of block
0
362-
363-
364-
365-
Switch to Source codePreprocessed file

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