When reading QJsonArray it gives always 0
Unsolved
General and Desktop
-
Or use a proper QDoubleSpinbox
-
Or a
QLineEdit
with an input mask, so you can be sure that is input of this widget gonna be a number. Then you can write it as double to your Json. -
@suslucoder said in When reading QJsonArray it gives always 0:
ı didnt get my json from anywhere. I create it by myself
So this is not a widget issue, at least at this stage. It's a question of OP deciding on a type to be used in the JSON.
-
Exactly. You should format the data properly when you save it. Then the whole problem will just go away and a plain
toDouble()
will work when reading the file. -
Thanks for all answers. I will reformat my json file and try it again