I use Qt designer, create a new form, add several line edit (qLineEdit) widgets, rename them the same as the fields in a QGIS attribute table, and save. In QGIS I associate the new .ui file in Layer Properties -> Fields, Under the Attribute editor layout dropdown I select, "Provide ui-file" and point to the file just created. Everything works fine, the .ui form displays correctly when a feature is selected.
I need better control over number formatting in the Qt .ui form display. For example:
- One field is a double, Real length 18, precision 11 that I need rounded to two decimals with a decimal point.
- Other fields are qlonglong, Integer64, length 10, precision 0 that I need displayed with commas (only if needed) as 1000 separators.
- One field I'd like to divide by 1000, round to the nearest integer and display with a "k" trailing in the output. (O.K. that may be pressing it...)
Are these "Number formatting operations" done only by adding new columns to the attribute table and then sending the data over to Qt in the exact desired format or does Qt have the capability of formatting numbers, prior to display?
Sorry, no C or C++ background but plenty of Excel & VBA. Strikes me that Qt is somewhat like a form generator/report writer (and if so it should have all the formatting capability you would need? Documentation on Qt designer is pretty harsh on the "uninitiated".
With a report writer you would never tamper with the underlying database structure. So, it seems pretty non intuitive creating new columns... However if that's the best way to do it (using the expression builder functions) I can go that route and get the job done.
Ideas? qLineEdit inputMask may be a way to go but it seems to force the output of commas even when the number is small.