Unsolved Displaying my JSON data in table view
-
@Vineela Maybe this will help: https://stackoverflow.com/questions/26148188/populate-qtableview-form-json-array
-
@jsulm thanks but little bit confused with the declaring error thing.
-
@Vineela If you get an error you should post the error here
-
-
@VRonin thnks but what about Widget than QML??
my only problem is how to display in TableView....
-
@jsulm
error: 'QJsonTableModel' has not been declared
error: 'episodes' was not declared in this scope
I didn't exactly get that code from the link properly (didn't understand) only with the declaring thing. -
@Vineela said in Displaying my JSON data in table view:
QJsonTableModel
this is not part of Qt. You can get it from https://github.com/poulh/qjsontablemodel
Or look how it is implemented to get some idea how to do it. -
@jsulm
I've added this one in my .h filepublic: typedef QMap<QString,QString> Heading; typedef QVector<Heading> Header; QJsonTableModel( const Header& header, QObject * parent = 0); bool setJson( const QJsonDocument& json ); bool setJson( const QJsonArray& array ); private: Header m_header; QJsonArray m_json;
and this one in my .cpp file
MainWindow::QJsonTableModel( const QJsonTableModel::Header& header ) : m_header( header ) { }
i got this error
error: ISO C++ forbids declaration of 'QJsonTableModel' with no type [-fpermissive]
QJsonTableModel( const Header& header, QObject * parent = 0); -
@Vineela This is not valid C++ and does not make sense. QJsonTableModel is a class. Download the header file and cpp file from the link I provided and add them to your project.
-
@jsulm well thanks ill try my best now sorry for my mistakes.
-
@Vineela There is some information how to use it in your code: https://github.com/poulh/qjsontablemodel/blob/master/README.md