mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-06 19:54:13 +02:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
<property name="saveddate" show="1">10/2/26</property>
|
||||
<property name="saveddate-eu" show="1">02-10-2026</property>
|
||||
<property name="saveddate-us" show="1">2026-10-02</property>
|
||||
<property name="savedfilename" show="1">skeleton</property>
|
||||
<property name="savedfilepath" show="1">/tmp/qet-mcp-new-k41dmnyo/skeleton.qet</property>
|
||||
<property name="savedfilename" show="1">free_text_width</property>
|
||||
<property name="savedtime" show="1">18:39</property>
|
||||
</properties>
|
||||
<usage enabled="true" time_spent="0"/>
|
||||
|
||||
Reference in New Issue
Block a user