read json file data to respective text fields
Hi,
I'm new to Qt and i have a question.
I have a json file (with first name, last name and age). I want to open json file using menu bar and read it to respective text fields (for first name, last name and age ) on mainwindow.
So how should i read json file data to respective text fields?
Thanks in advance,
Shoeb
Re: read json file data to respective text fields
You use QJsonDocument to parse the JSON data, extract the values you need and then call setText() on your text fields.
Cheers,
_
Re: read json file data to respective text fields
It worked.. thanks :)
Added after 6 minutes:
Hi.. thanks for help.. one more question.. On menu bar under help, i have a shortcut button and after click on that button i want to open new window with list of shortcut's.
I am able to open new window but not getting how to display list? how should i proceed?
--Shoeb
Re: read json file data to respective text fields
If you mean shortcuts on QActions, then you need some way to get all QActions, e.g. by storing their pointers in a QList member.
Then you can iterate through that list and get the name shortcut from each and put those into e.g. a QTableWidget
Cheers,
_