Tidy the free text width

- setTextWidth() returns without a signal when the width does not
  change, which is also the case on every load of a text without one.
- Say why IndependentTextItem::textWidth()/setTextWidth() hide the
  non-virtual QGraphicsTextItem functions, and what that means for code
  holding a base pointer.
- The fixture no longer carries a /tmp path from the machine it was
  made on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Beat Hangartner
2026-10-06 09:50:08 +02:00
parent 315de47a12
commit 069cf1e7b5
3 changed files with 8 additions and 2 deletions
@@ -130,6 +130,8 @@ void IndependentTextItem::setTextWidth(qreal width)
{
if (!qIsFinite(width) || width <= 0)
width = -1;
if (qFuzzyCompare(width, m_text_width))
return;
qreal document_width = width;
//The automatic width of a text with centred or right-aligned
@@ -53,6 +53,11 @@ class IndependentTextItem : public DiagramTextItem
void setUuid(const QUuid &uuid) {m_uuid = uuid; emit uuidChanged();}
void newUuid() {setUuid(QUuid::createUuid());} //create new uuid for this item
//Hide QGraphicsTextItem::textWidth()/setTextWidth(), which are not
//virtual: called through a QGraphicsTextItem or DiagramTextItem
//pointer they would change the document only, and the width would
//be neither saved nor shown in the properties. Use these, or the
//"textWidth" property.
qreal textWidth() const {return m_text_width;}
void setTextWidth(qreal width);