qtinuum / QtnProperty

Extended properties for Qt5
Apache License 2.0
427 stars 153 forks source link

How enter and display properties of double type in scientific notation #46

Open kleomash opened 3 years ago

kleomash commented 3 years ago

Hi!

I operate with small values which should be entered in scientific notation. For example 0.000000001 is more convenient when written as 1.0e-9.

Is it possible to set up display format for qtnCreateProperty?

lexxmark commented 3 years ago

Visual aspects of properties can be tuned by property delegates.

For example for Float property we have QtnPropertyDelegateFloat default delegate with min/max/step/suffix/multiplier/precision attributes which can be configured.

To modify these attributes you can use code like this:

    auto p = qtnCreateProperty<QtnPropertyFloat>(parent);
    p->setDelegateAttribute("min", -3);

Scientific/Regular notation is not supported now. I think it could be implemented in the existing delegate class or implemented as a separate delegate.

@kusharami It seems QtnPropertyDelegateFloat delegate was heavily refactored by you. What do you think about scientific notation support for Double/Float? Can we add such support to the existing delegate?

kusharami commented 3 years ago

What do you think about scientific notation support for Double/Float? Can we add such support to the existing delegate?

It seems that a new floating point spin box implementation is needed to achieve this