62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#ifndef DEVICEPARAMSTABLEFORM_H
|
|
#define DEVICEPARAMSTABLEFORM_H
|
|
|
|
#include <QWidget>
|
|
#include <QStyledItemDelegate>
|
|
|
|
namespace Ui {
|
|
class DeviceParamsTableForm;
|
|
}
|
|
|
|
class DeviceParamsItemDelegate : public QStyledItemDelegate
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DeviceParamsItemDelegate(QObject *parent = nullptr);
|
|
|
|
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
|
|
protected:
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
};
|
|
|
|
class DeviceParamsTableForm : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DeviceParamsTableForm(QWidget *parent = nullptr);
|
|
~DeviceParamsTableForm();
|
|
|
|
void SetConfigFilename(const QString& filename);
|
|
|
|
void SetButtonEnable(bool enable = true);
|
|
const QString& GetConfigName() const;
|
|
const QString& GetConfigDescription() const;
|
|
|
|
void ClearParamsTable();
|
|
bool SaveSelectedChannelConfig(const QString& save_filename, const QString &cfg_name = QString(), const QString &description = QString());
|
|
|
|
private slots:
|
|
void onAllSelectBtnClicked();
|
|
void onReserveSelectBtnClicked();
|
|
void onCfgChannelSelectBtnClicked();
|
|
void onCurrentChannelToOther();
|
|
void onSaveSelectedChannelConfig();
|
|
void onSaveSelectedChannelConfigToSys();
|
|
|
|
signals:
|
|
void deviceConfigParamsSaved(const QString& filename);
|
|
|
|
private:
|
|
Ui::DeviceParamsTableForm *ui;
|
|
QString _config_filename;
|
|
QString _cfg_name;
|
|
QString _cfg_description;
|
|
};
|
|
|
|
#endif // DEVICEPARAMSTABLEFORM_H
|