From 1d8b6597a36f266c3384553365326cf7ec9f8641 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 21 Feb 2014 15:18:00 +0100 Subject: [PATCH] QGraphicsWidget: micro-optimization Pass a temporary QVector instead of a named variable. Apart from less function calls, it also makes the code C++11-ready (enables move semantics). Change-Id: Ia7d3bed8aeae48453f96dc3c979f7ae394a5a26d Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/widgets/graphicsview/qgraphicsitem.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index d0a16690e6..1fdbe0fc18 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10829,9 +10829,7 @@ void QGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphic range.start = 0; range.length = layout.text().length(); range.format.setTextOutline(d->pen); - QVector formats; - formats.append(range); - layout.setFormats(formats); + layout.setFormats(QVector(1, range)); } setupTextLayout(&layout);