Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.0
-
None
Description
this is somewhat a bug and a feature-request, financial applications needs more precise numeric types that are not available by default in qml, c/c++ - im talking about Decimal.
there are a lot of custom c/c++ Decimal libraries on the market developed by intel, ibm etc.
on the c++ side its not a problem, the problem starts when developing qml gui.
printing such values is okay - can be acheived via:
class Decimal {
};
Q_DECLARE_METATYPE(Decimal)
QMetaType::registerConverter(&Decimal::ToQString);
but thats all - the problem are operators
there is no (public-api) way to make qml know about such type operators so math is complicated in qml.
would be nice if one could make something like this working:
property Decimal foo: 1.22
property Decimal bar: 1.55
property Decimal added: foo + bar//(and other math operators)
for now our workaround is that we created sub class ex: qmlDecimalMath that derives from QObject that has alot of Q_INVOKABLE functions that do math in c++ and returns values
for example:
Q_INVOKABLE Decimal add(Decimal _first, Decimal _second){ return _first + _second; }
but doing sometimes complex math is quite painful this way and very very hard to read(code)
what we are looking for is ability to create our own basic type like real (in qml)
Attachments
Issue Links
- relates to
-
QTBUG-82443 Value types and Containers in QML
- Closed