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>bb10
parent
4ee59cf96d
commit
0088f76043
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue