Adding CheckBox with QSqlQueryModel shown in QTableview and other columns are empty
问题 I am using the code in this answer to add checkbox in tableview. I want to show it in the first column. Here is my code: mysqlquerymodel.h #ifndef MYSQLQUERYMODEL_H #define MYSQLQUERYMODEL_H #include <QObject> #include <QMap> #include <QModelIndex> #include <QSqlQueryModel> class MySqlQueryModel : public QSqlQueryModel { Q_OBJECT public: explicit MySqlQueryModel(QObject *parent = 0); Qt::ItemFlags flags(const QModelIndex & index) const; QVariant data(const QModelIndex & index, int role) const