You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wheeldetect/src/tpMain/ModelTableView.h

76 lines
2.2 KiB
C

#pragma once
#include "qtableview.h"
#include "qmap.h"
#include "qstringlist.h"
#include "QAbstractItemModel"
#include "qobject.h"
#include "qstring.h"
class ModelCheckStateModel;
class ModelsModel;
class IWheelModel;
class ModelsView : public QObject
{
Q_OBJECT
public:
ModelsView(QTableView *, QMap<QString, IWheelModel* > *p);
~ModelsView();
Q_SLOT void update2AllModels();//刷新所有
Q_SLOT void update2AllModels(QString strExp);//strExp 不显示的内容
Q_SLOT void updateModels();
Q_SLOT void update2CurrentModels();//刷新当前显示的
void setEnable(bool);
void setCheckShow(bool b);
void removeModel(QString);
void setModelList(QStringList strList);
Q_SLOT void SlotListViewItem(const QModelIndex &);
void setHideItems(QStringList strList){ strHidItem = strList; };
signals:
void sgItemStateChange(QString);
void sgValueChange(QString);
void sgSelectModel(QString );
public:
QStringList strHidItem;
QTableView *m_pView;
ModelsModel *m_pModel;
};
class ModelsModel :public QAbstractTableModel
{
Q_OBJECT
public:
ModelsModel(QStringList lstHeader, QMap<QString, IWheelModel* > *pData);
~ModelsModel();
virtual QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role /* = Qt::EditRole */);
Qt::ItemFlags flags(const QModelIndex &index)const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void update2AllModels();
void update2AllModels(QString strExp);
void updateModels();
void update2CurrentModels();
void setModelList(QStringList strList);
void onStateChanged();
void onStateChanged(int state);
Q_SLOT void onValueChange(QString);
QString getModelByRow(int nRow);
void removeModel(QString);
void SetItemEnable(bool nEnable);
void SetCheckShow(bool nEnable);
signals:
void stateChanged(int);
void sgChangeState(QString);
private:
QMap<QString, IWheelModel* > *m_pData;
QStringList m_list;
QStringList m_lstHeader;
bool m_Enable;
bool m_ChackEnable;
int nGlobalMinImgs;
};