mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-08 04:44:13 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -28,12 +28,14 @@
|
||||
#include <QtGlobal>
|
||||
|
||||
/**
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user