Displaying my JSON data in table view
-
@jsulm well ok now i've changed it to JSON data check this link
http://13.232.156.73/CropMgt/Json/farmerList.php?ID=INKA010101
so i need them to display in my tableView format plz help me out.
-
@jsulm well ok now i've changed it to JSON data check this link
http://13.232.156.73/CropMgt/Json/farmerList.php?ID=INKA010101
so i need them to display in my tableView format plz help me out.
@Vineela Maybe this will help: https://stackoverflow.com/questions/26148188/populate-qtableview-form-json-array
-
@Vineela Maybe this will help: https://stackoverflow.com/questions/26148188/populate-qtableview-form-json-array
-
-
@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. -
@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); -
@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.
-
@Vineela There is some information how to use it in your code: https://github.com/poulh/qjsontablemodel/blob/master/README.md