summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
authorVitaly Fanaskov <vitaly.fanaskov@qt.io>2018-11-30 16:10:37 +0100
committerVitaly Fanaskov <vitaly.fanaskov@qt.io>2018-12-07 16:31:19 +0000
commit0088f760439b4f6f98342d3e22ecadbb13aaf06a (patch)
treea5ecd4f55957bbdb44efc917df1e9b0bca4f4d07 /src/widgets/graphicsview/qgraphicsitem.cpp
parent4ee59cf96d80c752ebfa127792d65d7b84abbd74 (diff)
Fix inability to edit lines in QGraphicsTextItem when pageSize is set
Previous implementation relies on the fact that the only text document with height -1 can grow or shrink vertically, and, hence, a bounding rect should be updated under this circumstances. But method QTextDocument::setPageSize might set a height different from -1, and QGraphicsTextItem will be growing/shrinking vertically as well. So, we have to relax condition to cover all use cases. Bounding rect will be updated if new size is different from current size. This also doesn't affect performance. Fixes: QTBUG-55527 Change-Id: Id2c8e15d859aff9dde62c8ee14a6859c0c03f0d4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index e81eab4c46..3a9bfab298 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -10569,14 +10569,11 @@ void QGraphicsTextItemPrivate::_q_update(QRectF rect)
*/
void QGraphicsTextItemPrivate::_q_updateBoundingRect(const QSizeF &size)
{
- if (!control) return; // can't happen
- const QSizeF pageSize = control->document()->pageSize();
- // paged items have a constant (page) size
- if (size == boundingRect.size() || pageSize.height() != -1)
- return;
- qq->prepareGeometryChange();
- boundingRect.setSize(size);
- qq->update();
+ if (size != boundingRect.size()) {
+ qq->prepareGeometryChange();
+ boundingRect.setSize(size);
+ qq->update();
+ }
}
/*!