bool setData(const QModelIndex &index,const QVariant &value, int role);
QObject::connect(model,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(initUpdate()));
private slots: void initUpdate();private: //модели для таблиц AmdinWidgetSqlModel *model;
void TableAmdinWidget::initUpdate(){}
class AmdinWidgetSqlModel : public QSqlQueryModel{ Q_OBJECTpublic: AmdinWidgetSqlModel(QObject *parent=0); bool setData(const QModelIndex &index, const QVariant &value, int role); Qt::ItemFlags flags(const QModelIndex &index) const; void refresh();
class TableAmdinWidget : public QObject{public: TableAmdinWidget(QObject *parent=0);
TableAmdinWidget::TableAmdinWidget(QObject *parent) : QObject(parent){ QObject::connect(model,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(initUpdate()));}
class TableAmdinWidget : public QObject{ Q_OBJECTpublic: TableAmdinWidget(QObject *parent=0);
#include <QtSql>#include <QDebug>#include <QtGui>#include "amdinwidgetsqlmodel.h"#include "libdelegate.h"class TableAmdinWidget : public QObject{ Q_OBJECTpublic: TableAmdinWidget(QObject *parent=0); void Active(QTableWidget* WidgetTitleMain,QTableView* ViewMain,QTableWidget* WidgetTitleOverload,QTableView* ViewOverload,QTableWidget* WidgetTitleRez,QTableView* ViewRez24,QTableView* ViewRezAll,QTableView* ViewOverloadMass,QTableView* ViewRezNow); void Passive(QTableWidget* WidgetTitleMain,QTableView* ViewMain,QTableWidget* WidgetTitleOverload,QTableView* ViewOverload,QTableWidget* WidgetTitleRez,QTableView* ViewRez24,QTableView* ViewRezAll,QTableView* ViewOverloadMass,QTableView* ViewRezNow); void DataKey(QString str) {dataKey=str;} private slots: void initUpdate();private: AmdinWidgetSqlModel *model; void initViewMain(QTableView* ViewMain); void initTitleMain(QTableWidget* TitleMain); void initTitleOverload(QTableWidget* TitleOverload); void initTitleRez(QTableWidget* TitleRez); void initViewRez24(QTableView *Rez24); void initViewOverload(QTableView *Overload); void initViewRezAll(QTableView *RezAll); void initViewOverloadMass(QTableView *OverloadMass); void initViewRezNow(QTableView *RezNow); QString dataKey; QPushButton* pushButtionUp; QPushButton* pushButtionDown;};
#include "tableamdinwidget.h"TableAmdinWidget::TableAmdinWidget(QObject *parent) : QObject(parent){ model= new AmdinWidgetSqlModel; QObject::connect(model,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(initUpdate()));}void TableAmdinWidget::initUpdate(){ qDebug()<<"мы в апдейте";}
#include <QSqlQueryModel>#include <QtSql>class AmdinWidgetSqlModel : public QSqlQueryModel{ Q_OBJECTpublic: AmdinWidgetSqlModel(QObject *parent=0); bool setData(const QModelIndex &index, const QVariant &value, int role); Qt::ItemFlags flags(const QModelIndex &index) const; void refresh(); void setDataTime(QString str){datetime=str;}