#ifndef ORDERSMODEL_H#define ORDERSMODEL_H#include <QSqlTableModel>class OrdersModel : public QSqlTableModel{ Q_OBJECTpublic: explicit OrdersModel(QObject *parent = 0);private: QVariant data(const QModelIndex &item, int role=Qt::DisplayRole) const;};#endif // ORDERSMODEL_H
#include "OrdersModel.h"OrdersModel::OrdersModel(QObject *parent) : QSqlTableModel(parent){}//---------------------------------------------------------------------QVariant OrdersModel::data(const QModelIndex &item, int role) const{ return QString("test");}//---------------------------------------------------------------------
#include "OrdersModel.h"OrdersModel::OrdersModel(QObject *parent) : QSqlTableModel(parent){}//---------------------------------------------------------------------QVariant OrdersModel::data(const QModelIndex &item, int role) const{ return QString("test");}//---------------------------------------------------------------------Qt::ItemFlags OrdersModel::flags(const QModelIndex &index) const{ return Qt::ItemIsEnabled;}//---------------------------------------------------------------------
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);