From 24a94ab833dac46790a58e8375dc226890994716 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 12 Nov 2014 15:45:43 +0100 Subject: [PATCH] QGraphicsTextItem: document that adjustSize can center/right align text Unlike QTextEdit, there's no implicit width for a QGraphicsTextItem, meaning any rich text that is supposed to be centered or right aligned will not be unless the user explicitly sets the width. There's also another possibility: calling adjustSize() manually. Document that. Task-number: QTBUG-312 Change-Id: I83023269f4c63643e8224887efe2143dd1bb1908 Reviewed-by: Andy Shaw --- src/widgets/graphicsview/qgraphicsitem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 8df2263325..03f22a270f 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -9791,6 +9791,7 @@ QVariant QGraphicsPixmapItem::extension(const QVariant &variant) const using textWidth(). \note In order to align HTML text in the center, the item's text width must be set. + Otherwise, you can call adjustSize() after setting the item's text. \image graphicsview-textitem.png