PDA

View Full Version : read json file data to respective text fields



shoeb
14th April 2016, 10:11
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

anda_skoa
14th April 2016, 10:35
You use QJsonDocument to parse the JSON data, extract the values you need and then call setText() on your text fields.

Cheers,
_

shoeb
14th April 2016, 11:44
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

anda_skoa
14th April 2016, 13:09
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,
_