From 2c9900eca8d203d8201c5d0eca1fcea40da85c1b Mon Sep 17 00:00:00 2001 From: Beat Hangartner Date: Wed, 7 Oct 2026 01:51:00 +0200 Subject: [PATCH] Make 0 the automatic width in the free text width box The box showed Auto for -1 while IndependentTextItem::setTextWidth() treats every value up to 0 as automatic. Typing 0, or the first click on the up arrow from Auto, then put a width change in the undo history that changed nothing, left the box on 0, and in live edit every later change of X, Y, angle, text or size was replaced by that empty command. Auto is 0 in the box now, like in the setter: no number is the automatic width, and the first step up is 1 px. Co-Authored-By: Claude Fable 5.1 --- sources/ui/inditextpropertieswidget.cpp | 8 +++++--- sources/ui/inditextpropertieswidget.ui | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sources/ui/inditextpropertieswidget.cpp b/sources/ui/inditextpropertieswidget.cpp index bae484752..afb2e0157 100644 --- a/sources/ui/inditextpropertieswidget.cpp +++ b/sources/ui/inditextpropertieswidget.cpp @@ -28,12 +28,14 @@ #include /** - @return width as shown in the width spin box: whole pixels, -1 for - the automatic width ("Auto"). + @return width as shown in the width spin box: whole pixels, 0 for the + automatic width ("Auto"). The box starts at 0, so no number means Auto + and the first step up is 1 px; IndependentTextItem::setTextWidth() + treats 0 as -1, the automatic width, so the two never disagree. */ static int spinBoxWidth(qreal width) { - return width > 0 ? qRound(width) : -1; + return width > 0 ? qRound(width) : 0; } /** diff --git a/sources/ui/inditextpropertieswidget.ui b/sources/ui/inditextpropertieswidget.ui index 6bdb94422..1572b1a34 100644 --- a/sources/ui/inditextpropertieswidget.ui +++ b/sources/ui/inditextpropertieswidget.ui @@ -148,13 +148,13 @@ px - -1 + 0 10000 - -1 + 0