Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgsoftwareinternalrectanglenode.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <qmath.h>
6
7#include <QtGui/QPainter>
8
10
12 : m_penWidth(0)
13 , m_radius(0)
14 , m_topLeftRadius(-1)
15 , m_topRightRadius(-1)
16 , m_bottomLeftRadius(-1)
17 , m_bottomRightRadius(-1)
18 , m_vertical(true)
19 , m_cornerPixmapIsDirty(true)
20 , m_devicePixelRatio(1)
21{
23 m_pen.setMiterLimit(0);
26}
27
36
38{
39 if (m_color != color) {
40 m_color = color;
41 m_cornerPixmapIsDirty = true;
43 }
44}
45
47{
48 if (m_penColor != color) {
49 m_penColor = color;
50 m_cornerPixmapIsDirty = true;
52 }
53}
54
56{
57 if (m_penWidth != width) {
58 m_penWidth = width;
59 m_cornerPixmapIsDirty = true;
61 }
62}
63
64//Move first stop by pos relative to seconds
65static QGradientStop interpolateStop(const QGradientStop &firstStop, const QGradientStop &secondStop, double newPos)
66{
67 double distance = secondStop.first - firstStop.first;
68 double distanceDelta = newPos - firstStop.first;
69 double modifierValue = distanceDelta / distance;
70 const auto firstStopRgbColor = firstStop.second.toRgb();
71 const auto secondStopRgbColor = secondStop.second.toRgb();
72 int redDelta = (secondStopRgbColor.red() - firstStopRgbColor.red()) * modifierValue;
73 int greenDelta = (secondStopRgbColor.green() - firstStopRgbColor.green()) * modifierValue;
74 int blueDelta = (secondStopRgbColor.blue() - firstStopRgbColor.blue()) * modifierValue;
75 int alphaDelta = (secondStopRgbColor.alpha() - firstStopRgbColor.alpha()) * modifierValue;
76
77 QGradientStop newStop;
78 newStop.first = newPos;
79 newStop.second = QColor(firstStopRgbColor.red() + redDelta,
80 firstStopRgbColor.green() + greenDelta,
81 firstStopRgbColor.blue() + blueDelta,
82 firstStopRgbColor.alpha() + alphaDelta);
83
84 return newStop;
85}
86
88{
89 //normalize stops
90 bool needsNormalization = false;
91 for (const QGradientStop &stop : std::as_const(stops)) {
92 if (stop.first < 0.0 || stop.first > 1.0) {
93 needsNormalization = true;
94 break;
95 }
96 }
97
98 if (needsNormalization) {
99 QGradientStops normalizedStops;
100 if (stops.size() == 1) {
101 //If there is only one stop, then the position does not matter
102 //It is just treated as a color
103 QGradientStop stop = stops.at(0);
104 stop.first = 0.0;
105 normalizedStops.append(stop);
106 } else {
107 //Clip stops to only the first below 0.0 and above 1.0
108 int below = -1;
109 int above = -1;
110 QVector<int> between;
111 for (int i = 0; i < stops.size(); ++i) {
112 if (stops.at(i).first < 0.0) {
113 below = i;
114 } else if (stops.at(i).first > 1.0) {
115 above = i;
116 break;
117 } else {
118 between.append(i);
119 }
120 }
121
122 //Interpoloate new color values for above and below
123 if (below != -1 ) {
124 //If there are more than one stops left, interpolate
125 if (below + 1 < stops.size()) {
126 normalizedStops.append(interpolateStop(stops.at(below), stops.at(below + 1), 0.0));
127 } else {
128 QGradientStop singleStop;
129 singleStop.first = 0.0;
130 singleStop.second = stops.at(below).second;
131 normalizedStops.append(singleStop);
132 }
133 }
134
135 for (int i = 0; i < between.size(); ++i)
136 normalizedStops.append(stops.at(between.at(i)));
137
138 if (above != -1) {
139 //If there stops before above, interpolate
140 if (above >= 1) {
141 normalizedStops.append(interpolateStop(stops.at(above), stops.at(above - 1), 1.0));
142 } else {
143 QGradientStop singleStop;
144 singleStop.first = 1.0;
145 singleStop.second = stops.at(above).second;
146 normalizedStops.append(singleStop);
147 }
148 }
149 }
150
151 m_stops = normalizedStops;
152
153 } else {
154 m_stops = stops;
155 }
156 m_cornerPixmapIsDirty = true;
158}
159
161{
162 if (m_vertical != vertical) {
163 m_vertical = vertical;
164 m_cornerPixmapIsDirty = true;
166 }
167}
168
170{
171 if (m_radius != radius) {
172 m_radius = radius;
173 m_cornerPixmapIsDirty = true;
175 }
176}
177
179{
180 if (m_topLeftRadius != radius) {
181 m_topLeftRadius = radius;
182 m_cornerPixmapIsDirty = true;
184 }
185}
186
188{
189 if (m_topRightRadius != radius) {
190 m_topRightRadius = radius;
191 m_cornerPixmapIsDirty = true;
193 }
194}
195
197{
198 if (m_bottomLeftRadius != radius) {
199 m_bottomLeftRadius = radius;
200 m_cornerPixmapIsDirty = true;
202 }
203}
204
206{
207 if (m_bottomRightRadius != radius) {
208 m_bottomRightRadius = radius;
209 m_cornerPixmapIsDirty = true;
211 }
212}
213
215{
216}
217
219{
220 if (!m_penWidth || m_penColor == Qt::transparent) {
221 m_pen = Qt::NoPen;
222 } else {
223 m_pen = QPen(m_penColor);
224 m_pen.setWidthF(m_penWidth);
225 }
226
227 if (!m_stops.isEmpty()) {
228 QLinearGradient gradient(QPoint(0,0), QPoint(m_vertical ? 0 : m_rect.width(), m_vertical ? m_rect.height() : 0));
229 gradient.setStops(m_stops);
230 m_brush = QBrush(gradient);
231 } else {
232 m_brush = QBrush(m_color);
233 }
234
235 if (m_cornerPixmapIsDirty) {
236 generateCornerPixmap();
237 m_cornerPixmapIsDirty = false;
238 }
239}
240
242{
243 //We can only check for a device pixel ratio change when we know what
244 //paint device is being used.
245 if (!qFuzzyCompare(painter->device()->devicePixelRatio(), m_devicePixelRatio)) {
246 m_devicePixelRatio = painter->device()->devicePixelRatio();
247 generateCornerPixmap();
248 }
249
250 if (painter->transform().isRotating()) {
251 //Rotated rectangles lose the benefits of direct rendering, and have poor rendering
252 //quality when using only blits and fills.
253
254 if (m_radius == 0
255 && m_penWidth == 0
256 && m_topLeftRadius <= 0
257 && m_topRightRadius <= 0
258 && m_bottomLeftRadius <= 0
259 && m_bottomRightRadius <= 0) {
260 //Non-Rounded Rects without borders (fall back to drawRect)
261 //Most common case
263 painter->setBrush(m_brush);
264 painter->drawRect(m_rect);
265 } else if (m_topLeftRadius < 0
266 && m_topRightRadius < 0
267 && m_bottomLeftRadius < 0
268 && m_bottomRightRadius < 0) {
269 //Rounded Rects and Rects with Borders
270 //Avoids broken behaviors of QPainter::drawRect/roundedRect
271 QPixmap pixmap = QPixmap(qRound(m_rect.width() * m_devicePixelRatio), qRound(m_rect.height() * m_devicePixelRatio));
273 pixmap.setDevicePixelRatio(m_devicePixelRatio);
274 QPainter pixmapPainter(&pixmap);
275 paintRectangle(&pixmapPainter, QRect(0, 0, m_rect.width(), m_rect.height()));
276
277 QPainter::RenderHints previousRenderHints = painter->renderHints();
279 painter->drawPixmap(m_rect, pixmap);
280 painter->setRenderHints(previousRenderHints);
281 } else {
282 // Corners with different radii. Split implementation to avoid
283 // performance regression of the majority of cases
284 QPixmap pixmap = QPixmap(qRound(m_rect.width() * m_devicePixelRatio), qRound(m_rect.height() * m_devicePixelRatio));
286 pixmap.setDevicePixelRatio(m_devicePixelRatio);
287 QPainter pixmapPainter(&pixmap);
288 // Slow function relying on paths
289 paintRectangleIndividualCorners(&pixmapPainter, QRect(0, 0, m_rect.width(), m_rect.height()));
290
291 QPainter::RenderHints previousRenderHints = painter->renderHints();
293 painter->drawPixmap(m_rect, pixmap);
294 painter->setRenderHints(previousRenderHints);
295
296 }
297
298
299 } else {
300 //Paint directly
301 if (m_topLeftRadius < 0
302 && m_topRightRadius < 0
303 && m_bottomLeftRadius < 0
304 && m_bottomRightRadius < 0) {
305 paintRectangle(painter, m_rect);
306 } else {
307 paintRectangleIndividualCorners(painter, m_rect);
308 }
309 }
310
311}
312
314{
315 if (m_radius > 0.0f)
316 return false;
317 if (m_color.alpha() < 255)
318 return false;
319 if (m_penWidth > 0.0f && m_penColor.alpha() < 255)
320 return false;
321 if (m_stops.size() > 0) {
322 for (const QGradientStop &stop : std::as_const(m_stops)) {
323 if (stop.second.alpha() < 255)
324 return false;
325 }
326 }
327
328 return true;
329}
330
332{
333 //TODO: double check that this is correct.
334 return m_rect;
335}
336
337void QSGSoftwareInternalRectangleNode::paintRectangle(QPainter *painter, const QRect &rect)
338{
339 //Radius should never exceeds half of the width or half of the height
340 int radius = qFloor(qMin(qMin(rect.width(), rect.height()) * 0.5, m_radius));
341
342 QPainter::RenderHints previousRenderHints = painter->renderHints();
344
345 if (m_penWidth > 0) {
346 //Fill border Rects
347
348 //Borders can not be more than half the height/width of a rect
349 double borderWidth = qMin(m_penWidth, rect.width() * 0.5);
350 double borderHeight = qMin(m_penWidth, rect.height() * 0.5);
351
352
353
354 if (borderWidth > radius) {
355 //4 Rects
356 QRectF borderTopOutside(QPointF(rect.x() + radius, rect.y()),
357 QPointF(rect.x() + rect.width() - radius, rect.y() + radius));
358 QRectF borderTopInside(QPointF(rect.x() + borderWidth, rect.y() + radius),
359 QPointF(rect.x() + rect.width() - borderWidth, rect.y() + borderHeight));
360 QRectF borderBottomOutside(QPointF(rect.x() + radius, rect.y() + rect.height() - radius),
361 QPointF(rect.x() + rect.width() - radius, rect.y() + rect.height()));
362 QRectF borderBottomInside(QPointF(rect.x() + borderWidth, rect.y() + rect.height() - borderHeight),
363 QPointF(rect.x() + rect.width() - borderWidth, rect.y() + rect.height() - radius));
364
365 if (borderTopOutside.isValid())
366 painter->fillRect(borderTopOutside, m_penColor);
367 if (borderTopInside.isValid())
368 painter->fillRect(borderTopInside, m_penColor);
369 if (borderBottomOutside.isValid())
370 painter->fillRect(borderBottomOutside, m_penColor);
371 if (borderBottomInside.isValid())
372 painter->fillRect(borderBottomInside, m_penColor);
373
374 } else {
375 //2 Rects
376 QRectF borderTop(QPointF(rect.x() + radius, rect.y()),
377 QPointF(rect.x() + rect.width() - radius, rect.y() + borderHeight));
378 QRectF borderBottom(QPointF(rect.x() + radius, rect.y() + rect.height() - borderHeight),
379 QPointF(rect.x() + rect.width() - radius, rect.y() + rect.height()));
380 if (borderTop.isValid())
381 painter->fillRect(borderTop, m_penColor);
382 if (borderBottom.isValid())
383 painter->fillRect(borderBottom, m_penColor);
384 }
385 QRectF borderLeft(QPointF(rect.x(), rect.y() + radius),
386 QPointF(rect.x() + borderWidth, rect.y() + rect.height() - radius));
387 QRectF borderRight(QPointF(rect.x() + rect.width() - borderWidth, rect.y() + radius),
388 QPointF(rect.x() + rect.width(), rect.y() + rect.height() - radius));
389 if (borderLeft.isValid())
390 painter->fillRect(borderLeft, m_penColor);
391 if (borderRight.isValid())
392 painter->fillRect(borderRight, m_penColor);
393 }
394
395
396 if (radius > 0) {
397
398 if (radius * 2 >= rect.width() && radius * 2 >= rect.height()) {
399 //Blit whole pixmap for circles
400 painter->drawPixmap(rect, m_cornerPixmap, m_cornerPixmap.rect());
401 } else {
402
403 //blit 4 corners to border
404 int scaledRadius = qRound(radius * m_devicePixelRatio);
405 QRectF topLeftCorner(QPointF(rect.x(), rect.y()),
406 QPointF(rect.x() + radius, rect.y() + radius));
407 painter->drawPixmap(topLeftCorner, m_cornerPixmap, QRectF(0, 0, scaledRadius, scaledRadius));
408 QRectF topRightCorner(QPointF(rect.x() + rect.width() - radius, rect.y()),
409 QPointF(rect.x() + rect.width(), rect.y() + radius));
410 painter->drawPixmap(topRightCorner, m_cornerPixmap, QRectF(scaledRadius, 0, scaledRadius, scaledRadius));
411 QRectF bottomLeftCorner(QPointF(rect.x(), rect.y() + rect.height() - radius),
412 QPointF(rect.x() + radius, rect.y() + rect.height()));
413 painter->drawPixmap(bottomLeftCorner, m_cornerPixmap, QRectF(0, scaledRadius, scaledRadius, scaledRadius));
414 QRectF bottomRightCorner(QPointF(rect.x() + rect.width() - radius, rect.y() + rect.height() - radius),
415 QPointF(rect.x() + rect.width(), rect.y() + rect.height()));
416 painter->drawPixmap(bottomRightCorner, m_cornerPixmap, QRectF(scaledRadius, scaledRadius, scaledRadius, scaledRadius));
417
418 }
419
420 }
421
422 QRectF brushRect = QRectF(rect).marginsRemoved(QMarginsF(m_penWidth, m_penWidth, m_penWidth, m_penWidth));
423 if (brushRect.width() < 0)
424 brushRect.setWidth(0);
425 if (brushRect.height() < 0)
426 brushRect.setHeight(0);
427 double innerRectRadius = qMax(0.0, radius - m_penWidth);
428
429 //If not completely transparent or has a gradient
430 if (m_color.alpha() > 0 || !m_stops.empty()) {
431 if (innerRectRadius > 0) {
432 //Rounded Rect
433 if (m_stops.empty()) {
434 //Rounded Rects without gradient need 3 blits
435 QRectF centerRect(QPointF(brushRect.x() + innerRectRadius, brushRect.y()),
436 QPointF(brushRect.x() + brushRect.width() - innerRectRadius, brushRect.y() + brushRect.height()));
437 painter->fillRect(centerRect, m_color);
438 QRectF leftRect(QPointF(brushRect.x(), brushRect.y() + innerRectRadius),
439 QPointF(brushRect.x() + innerRectRadius, brushRect.y() + brushRect.height() - innerRectRadius));
440 painter->fillRect(leftRect, m_color);
441 QRectF rightRect(QPointF(brushRect.x() + brushRect.width() - innerRectRadius, brushRect.y() + innerRectRadius),
442 QPointF(brushRect.x() + brushRect.width(), brushRect.y() + brushRect.height() - innerRectRadius));
443 painter->fillRect(rightRect, m_color);
444 } else {
445 //Rounded Rect with gradient (slow)
447 painter->setBrush(m_brush);
448 painter->drawRoundedRect(brushRect, innerRectRadius, innerRectRadius);
449 }
450 } else {
451 //non-rounded rects only need 1 blit
452 painter->fillRect(brushRect, m_brush);
453 }
454 }
455
456 painter->setRenderHints(previousRenderHints);
457}
458
459void QSGSoftwareInternalRectangleNode::paintRectangleIndividualCorners(QPainter *painter, const QRect &rect)
460{
462
463 const float w = m_penWidth;
464
465 // Radius should never exceeds half of the width or half of the height
466 const float radiusTL = qMin(qMin(rect.width(), rect.height()) * 0.5f, float(m_topLeftRadius < 0. ? m_radius : m_topLeftRadius));
467 const float radiusTR = qMin(qMin(rect.width(), rect.height()) * 0.5f, float(m_topRightRadius < 0. ? m_radius : m_topRightRadius));
468 const float radiusBL = qMin(qMin(rect.width(), rect.height()) * 0.5f, float(m_bottomLeftRadius < 0. ? m_radius : m_bottomLeftRadius));
469 const float radiusBR = qMin(qMin(rect.width(), rect.height()) * 0.5f, float(m_bottomRightRadius < 0 ? m_radius : m_bottomRightRadius));
470
471 const float innerRadiusTL = qMin(qMin(rect.width(), rect.height()) * 0.5f, radiusTL - w);
472 const float innerRadiusTR = qMin(qMin(rect.width(), rect.height()) * 0.5f, radiusTR - w);
473 const float innerRadiusBL = qMin(qMin(rect.width(), rect.height()) * 0.5f, radiusBL - w);
474 const float innerRadiusBR = qMin(qMin(rect.width(), rect.height()) * 0.5f, radiusBR - w);
475
476 QRect rect2 = rect.adjusted(0, 0, 1, 1);
477
478 path.moveTo(rect2.topRight() - QPointF(radiusTR, -w));
479 if (innerRadiusTR > 0.)
480 path.arcTo(QRectF(rect2.topRight() - QPointF(radiusTR + innerRadiusTR, -w), 2. * QSizeF(innerRadiusTR, innerRadiusTR)), 90, -90);
481 else
482 path.lineTo(rect2.topRight() - QPointF(w, -w));
483
484 if (innerRadiusBR > 0.)
485 path.arcTo(QRectF(rect2.bottomRight() - QPointF(radiusBR + innerRadiusBR, radiusBR + innerRadiusBR), 2. * QSizeF(innerRadiusBR, innerRadiusBR)), 0, -90);
486 else
487 path.lineTo(rect2.bottomRight() - QPointF(w, w));
488
489 if (innerRadiusBL > 0.)
490 path.arcTo(QRectF(rect2.bottomLeft() - QPointF(-w, radiusBL + innerRadiusBL), 2. * QSizeF(innerRadiusBL, innerRadiusBL)), -90, -90);
491 else
492 path.lineTo(rect2.bottomLeft() - QPointF(-w, w));
493 if (innerRadiusTL > 0.)
494 path.arcTo(QRectF(rect2.topLeft() + QPointF(w, w), 2. * QSizeF(innerRadiusTL, innerRadiusTL)), -180, -90);
495 else
496 path.lineTo(rect2.topLeft() + QPointF(w, w));
497 path.closeSubpath();
498
500 painter->setBrush(m_brush);
502
503 if (w > 0) {
504 path.moveTo(rect2.topRight() - QPointF(radiusTR, 0.));
505 if (radiusTR > 0.)
506 path.arcTo(QRectF(rect2.topRight() - 2. * QPointF(radiusTR, 0.), 2. * QSizeF(radiusTR, radiusTR)), 90, -90);
507 else
508 path.lineTo(rect2.topRight());
509 if (radiusBR > 0.)
510 path.arcTo(QRectF(rect2.bottomRight() - 2. * QPointF(radiusBR, radiusBR), 2. * QSizeF(radiusBR, radiusBR)), 0, -90);
511 else
512 path.lineTo(rect2.bottomRight());
513 if (radiusBL > 0.)
514 path.arcTo(QRectF(rect2.bottomLeft() - 2. * QPointF(0., radiusBL), 2. * QSizeF(radiusBL, radiusBL)), -90, -90);
515 else
516 path.lineTo(rect2.bottomLeft());
517 if (radiusTL > 0.)
518 path.arcTo(QRectF(rect2.topLeft() - 2. * QPointF(0., 0.), 2. * QSizeF(radiusTL, radiusTL)), -180, -90);
519 else
520 path.lineTo(rect2.topLeft());
521 path.closeSubpath();
522
523 painter->setBrush(m_penColor);
525 }
526}
527
528void QSGSoftwareInternalRectangleNode::generateCornerPixmap()
529{
530 //Generate new corner Pixmap
531 int radius = qFloor(qMin(qMin(m_rect.width(), m_rect.height()) * 0.5, m_radius));
532 const auto width = qRound(radius * 2 * m_devicePixelRatio);
533
534 if (m_cornerPixmap.width() != width)
535 m_cornerPixmap = QPixmap(width, width);
536
537 m_cornerPixmap.setDevicePixelRatio(m_devicePixelRatio);
538 m_cornerPixmap.fill(Qt::transparent);
539
540 if (radius > 0) {
541 QPainter cornerPainter(&m_cornerPixmap);
542 cornerPainter.setRenderHint(QPainter::Antialiasing);
543 cornerPainter.setCompositionMode(QPainter::CompositionMode_Source);
544
545 //Paint outer cicle
546 if (m_penWidth > 0) {
547 cornerPainter.setPen(Qt::NoPen);
548 cornerPainter.setBrush(m_penColor);
549 cornerPainter.drawRoundedRect(QRectF(0, 0, radius * 2, radius *2), radius, radius);
550 }
551
552 //Paint inner circle
553 if (radius > m_penWidth) {
554 cornerPainter.setPen(Qt::NoPen);
555 if (m_stops.isEmpty())
556 cornerPainter.setBrush(m_brush);
557 else
558 cornerPainter.setBrush(Qt::transparent);
559
560 QMarginsF adjustmentMargins(m_penWidth, m_penWidth, m_penWidth, m_penWidth);
561 QRectF cornerCircleRect = QRectF(0, 0, radius * 2, radius * 2).marginsRemoved(adjustmentMargins);
562 cornerPainter.drawRoundedRect(cornerCircleRect, radius, radius);
563 }
564 cornerPainter.end();
565 }
566}
567
\inmodule QtGui
Definition qbrush.h:30
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
int alpha() const noexcept
Returns the alpha color component of this color.
Definition qcolor.cpp:1466
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
Definition qbrush.cpp:1608
\inmodule QtGui
Definition qbrush.h:394
qsizetype size() const noexcept
Definition qlist.h:397
bool isEmpty() const noexcept
Definition qlist.h:401
bool empty() const noexcept
Definition qlist.h:685
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
\inmodule QtCore
Definition qmargins.h:270
qreal devicePixelRatio() const
\inmodule QtGui
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
Definition qpainter.h:519
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or \nullptr if the painter is n...
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
@ SmoothPixmapTransform
Definition qpainter.h:54
@ Antialiasing
Definition qpainter.h:52
const QTransform & transform() const
Alias for worldTransform().
@ CompositionMode_Source
Definition qpainter.h:101
void setRenderHints(RenderHints hints, bool on=true)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint.
void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
\inmodule QtGui
Definition qpen.h:28
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
Definition qpen.cpp:618
void setJoinStyle(Qt::PenJoinStyle pcs)
Sets the pen's join style to the given style.
Definition qpen.cpp:677
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
Definition qpen.cpp:545
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
int width() const
Returns the width of the pixmap.
Definition qpixmap.cpp:468
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the pixmap.
Definition qpixmap.cpp:604
QRect rect() const
Returns the pixmap's enclosing rectangle.
Definition qpixmap.cpp:505
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition qpixmap.cpp:850
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:484
QRect toAlignedRect() const noexcept
Definition qrect.cpp:2338
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:672
constexpr qreal height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:732
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:729
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:669
constexpr QRectF marginsRemoved(const QMarginsF &margins) const noexcept
Definition qrect.h:895
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition qrect.h:813
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
Definition qsgnode.cpp:764
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:927
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
The QSGMaterial class encapsulates rendering state for a shader program.
Definition qsgmaterial.h:15
@ DirtyMaterial
Definition qsgnode.h:75
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:624
void setColor(const QColor &color) override
void setGradientStops(const QGradientStops &stops) override
void setPenColor(const QColor &color) override
\inmodule QtCore
Definition qsize.h:208
bool isRotating() const
Returns true if the matrix represents some kind of a rotating transformation, otherwise returns false...
Definition qtransform.h:183
rect
[4]
Combined button and popup list for selecting options.
@ transparent
Definition qnamespace.h:47
@ NoPen
@ MiterJoin
QPair< qreal, QColor > QGradientStop
Definition qbrush.h:131
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:327
int qFloor(T v)
Definition qmath.h:42
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLfloat GLfloat GLfloat w
[0]
GLsizei GLsizei GLfloat distance
GLint GLsizei width
GLuint color
[2]
GLsizei const GLchar *const * path
static QRectF alignedRect(bool mirrored, Qt::Alignment alignment, const QSizeF &size, const QRectF &rectangle)
static QGradientStop interpolateStop(const QGradientStop &firstStop, const QGradientStop &secondStop, double newPos)
static QGradientStop interpolateStop(const QGradientStop &firstStop, const QGradientStop &secondStop, double newPos)
double qreal
Definition qtypes.h:187
widget render & pixmap
QPainter painter(this)
[7]