mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-03 18:44:13 +02:00
d192d609ec
A cyclic part could only ever be rendered at its natural width, which is fine for one of @scorpio810's two real layouts and wrong for the other: April 5000/2000, 32-point cards %IX0.0 .. %IX0.31, then %IX1.0 Schneider M340, 64-point cards I1.00 .. I1.63, then I2.00 The first wants no padding, the second wants two digits. Since the two conflict, the width cannot be derived from the modulus or from the part type -- it has to be the user's to set. Add a format field holding a run of zeros, the same convention a spreadsheet uses for integer padding: "00" renders 7 as 07, "000" as 007. The field's length is the minimum number of digits. It applies to every numeric part type, not only cyclic ones, so "Chiffre 01" can be widened past two digits without inventing another type for it. An empty mask means the part type's own natural width, so it reproduces exactly what every existing context does today -- Chiffre 1 stays 7, Chiffre 01 stays 07, Chiffre 001 stays 007. That is what makes this safe for existing projects: absent is the default, and absent changes nothing. Stored as a sixth field on the context part and as an XML attribute written only when set, following how modulus was added: readers guard on size() and treat a short item as "no format". All seven places that rebuild a part while incrementing it now carry the format through -- missing one would have silently dropped the padding on the second element numbered. The editor field is restricted to zeros by a validator, and is enabled only for types that render as a number. Measured: April, mask empty %IX0.29 %IX0.30 %IX0.31 %IX1.0 %IX1.1 M340, mask "00" I1.00 I1.01 ... I1.62 I1.63 I2.00 I2.01 no mask unit 7,8,9 ten 07,08,09 hundred 007,008,009 ten with mask "0000" 0007 0008 0009
156 lines
4.1 KiB
XML
156 lines
4.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<ui version="4.0">
|
|
<class>NumPartEditorW</class>
|
|
<widget class="QWidget" name="NumPartEditorW">
|
|
<property name="geometry">
|
|
<rect>
|
|
<x>0</x>
|
|
<y>0</y>
|
|
<width>368</width>
|
|
<height>33</height>
|
|
</rect>
|
|
</property>
|
|
<property name="windowTitle">
|
|
<string>Form</string>
|
|
</property>
|
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
<property name="spacing">
|
|
<number>3</number>
|
|
</property>
|
|
<property name="leftMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<property name="topMargin">
|
|
<number>2</number>
|
|
</property>
|
|
<property name="rightMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<property name="bottomMargin">
|
|
<number>2</number>
|
|
</property>
|
|
<item>
|
|
<widget class="QComboBox" name="type_cb">
|
|
<property name="sizePolicy">
|
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
<horstretch>0</horstretch>
|
|
<verstretch>0</verstretch>
|
|
</sizepolicy>
|
|
</property>
|
|
<property name="editable">
|
|
<bool>true</bool>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QLineEdit" name="value_field">
|
|
<property name="sizePolicy">
|
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
<horstretch>0</horstretch>
|
|
<verstretch>0</verstretch>
|
|
</sizepolicy>
|
|
</property>
|
|
<property name="clearButtonEnabled">
|
|
<bool>true</bool>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QSpinBox" name="increase_spinBox">
|
|
<property name="enabled">
|
|
<bool>true</bool>
|
|
</property>
|
|
<property name="sizePolicy">
|
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
<horstretch>0</horstretch>
|
|
<verstretch>0</verstretch>
|
|
</sizepolicy>
|
|
</property>
|
|
<property name="minimumSize">
|
|
<size>
|
|
<width>0</width>
|
|
<height>0</height>
|
|
</size>
|
|
</property>
|
|
<property name="wrapping">
|
|
<bool>false</bool>
|
|
</property>
|
|
<property name="toolTip">
|
|
<string>Mettre à 0 pour un chiffre qui n'avance que par le report d'un chiffre cyclique suivant (ex: le "0" de "0.7")</string>
|
|
</property>
|
|
<property name="alignment">
|
|
<set>Qt::AlignCenter</set>
|
|
</property>
|
|
<property name="specialValueText">
|
|
<string/>
|
|
</property>
|
|
<property name="accelerated">
|
|
<bool>true</bool>
|
|
</property>
|
|
<property name="prefix">
|
|
<string/>
|
|
</property>
|
|
<property name="minimum">
|
|
<number>0</number>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QSpinBox" name="modulus_spinBox">
|
|
<property name="enabled">
|
|
<bool>false</bool>
|
|
</property>
|
|
<property name="sizePolicy">
|
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
<horstretch>0</horstretch>
|
|
<verstretch>0</verstretch>
|
|
</sizepolicy>
|
|
</property>
|
|
<property name="toolTip">
|
|
<string>Valeur à laquelle ce chiffre revient à 0 en incrémentant le chiffre précédent (0 = pas de cycle)</string>
|
|
</property>
|
|
<property name="alignment">
|
|
<set>Qt::AlignCenter</set>
|
|
</property>
|
|
<property name="accelerated">
|
|
<bool>true</bool>
|
|
</property>
|
|
<property name="prefix">
|
|
<string>mod. </string>
|
|
</property>
|
|
<property name="minimum">
|
|
<number>0</number>
|
|
</property>
|
|
<property name="maximum">
|
|
<number>99999</number>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QLineEdit" name="format_le">
|
|
<property name="enabled">
|
|
<bool>false</bool>
|
|
</property>
|
|
<property name="maximumSize">
|
|
<size>
|
|
<width>70</width>
|
|
<height>16777215</height>
|
|
</size>
|
|
</property>
|
|
<property name="toolTip">
|
|
<string>Format d'affichage : une suite de zéros donne le nombre minimum de chiffres (00 = 07, 000 = 007). Vide = largeur naturelle du type.</string>
|
|
</property>
|
|
<property name="placeholderText">
|
|
<string>0</string>
|
|
</property>
|
|
<property name="alignment">
|
|
<set>Qt::AlignCenter</set>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
<resources/>
|
|
<connections/>
|
|
</ui>
|