aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/customitems/painteditem/textballoon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/customitems/painteditem/textballoon.cpp')
-rw-r--r--examples/quick/customitems/painteditem/textballoon.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/quick/customitems/painteditem/textballoon.cpp b/examples/quick/customitems/painteditem/textballoon.cpp
index 1713cc762f..bd8248e65e 100644
--- a/examples/quick/customitems/painteditem/textballoon.cpp
+++ b/examples/quick/customitems/painteditem/textballoon.cpp
@@ -67,23 +67,24 @@ void TextBalloon::paint(QPainter *painter)
painter->setPen(Qt::NoPen);
painter->setRenderHint(QPainter::Antialiasing);
- painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height() - 10, 10, 10);
+ QSizeF itemSize = size();
+ painter->drawRoundedRect(0, 0, itemSize.width(), itemSize.height() - 10, 10, 10);
if (rightAligned)
{
const QPointF points[3] = {
- QPointF(boundingRect().width() - 10.0, boundingRect().height() - 10.0),
- QPointF(boundingRect().width() - 20.0, boundingRect().height()),
- QPointF(boundingRect().width() - 30.0, boundingRect().height() - 10.0),
+ QPointF(itemSize.width() - 10.0, itemSize.height() - 10.0),
+ QPointF(itemSize.width() - 20.0, itemSize.height()),
+ QPointF(itemSize.width() - 30.0, itemSize.height() - 10.0),
};
painter->drawConvexPolygon(points, 3);
}
else
{
const QPointF points[3] = {
- QPointF(10.0, boundingRect().height() - 10.0),
- QPointF(20.0, boundingRect().height()),
- QPointF(30.0, boundingRect().height() - 10.0),
+ QPointF(10.0, itemSize.height() - 10.0),
+ QPointF(20.0, itemSize.height()),
+ QPointF(30.0, itemSize.height() - 10.0),
};
painter->drawConvexPolygon(points, 3);
}