aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/customitems/painteditem/textballoon.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-04-14 10:39:54 +0200
committerRobin Burchell <robin.burchell@crimson.no>2017-04-21 13:28:41 +0000
commitac29d0811ee1d712aefd2468374354de948bebfd (patch)
tree5b77051df2eb2ace37b73741715761eab95e49c9 /examples/quick/customitems/painteditem/textballoon.cpp
parent0aaca005c0bb6267ddd14a84634c33c813e2d2c4 (diff)
examples: Remove some unnecessary (and non-ideal) use of internal API
boundingRect is not documented for public use, and there's no need to repeatedly call it either. Change-Id: I844c704da0c0e7a5e94b387c5ebe9b26dc6b59fe Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
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);
}