|
For QDoubleSpinBox (and thus the custom QtDoubleSpinBox subclass
used in QtFormattedSpinBox), the number of decimals set via
QDoubleSpinBox::setDecimals [1] does not only affect how
many decimals are displayed, but also applies to the
actual value used (which makes sure they are consistent).
As a consequence, setting the amount of decimals to 0
results in rounding to an integer when setting the value.
So far, this happened for SvxDecimalNumberDialog because
the "digits" property for the "GtkSpinButton" in the .ui
file uses the default value of 0.
Change this to 2 instead (which matches the amount of decimals
shown with both, the GTK and the VCL variants) when opening the
dialog.
For SvxNumberDialog that uses the same .ui file, explicitly
set the number of decimals to 0, to keep the behavior unchanged
for that one.
This addresses those issues mentioned in previous commit
Change-Id: I25707ab6c5877eea2270bc21a27d08483d0f52e6
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Thu Feb 20 11:12:51 2025 +0100
tdf#130857 qt weld: Support Svx(Decimal)NumberDialog
> Handling for decimal numbers using QtInstanceFormattedSpinButton
> still needs some tweaks that will be done in upcoming commits.
> (For example, it currently rounds the value when double-clicking
> on a proparty that has a floating point value set, and only allows
> typing integer values, not actual floating point values.)
[1] https://doc.qt.io/qt-6/qdoublespinbox.html#decimals-prop
Change-Id: I9a242c704a1199cbbf7b16e96151d950223905b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181948
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
|