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.
nmWTAI-Platform/Include/nmNum/nmSubWxs/nmWxDFNLoadFromFile.h

95 lines
2.2 KiB
C

#ifndef NMWXDFNLOADFROMFILE_H
#define NMWXDFNLOADFROMFILE_H
#include "nmSubWxs_global.h"
#include <QDialog>
#include <QGroupBox>
#include <QCheckBox>
#include <QLineEdit>
#include <QTableWidget>
#include <QPushButton>
#include <QLabel>
struct DFNData {
double x1; // 坐标X1
double y1; // 坐标Y1
double x2; // 坐标X2
double y2; // 坐标Y2
double fc; // Fc值
double wf; // Wf值
double o; // o值
};
// DFN从文件导入页面
class NM_SUB_WXS_EXPORT nmWxDFNLoadFromFile : public QDialog
{
Q_OBJECT
public:
explicit nmWxDFNLoadFromFile(QWidget* pParent = nullptr);
~nmWxDFNLoadFromFile();
private slots:
void onOkClicked();
void onCancelClicked();
void onLoadTxtClicked();
void onLoadExcelClicked();
void onBrowseClicked();
void onTableClicked(int row, int col);
void onCellChanged(int row, int col);
void updateSeparators();
private:
void initUI();
void initConnections();
void setupTable();
// 初始化映射关系
void initUnitMappings();
void closeOpenComboBox();
void clearDataRows();
void setupTableColumns(int columnCount);
void populateDataRows(const QList<QStringList>& dataLines);
QRegExp buildSeparatorRegex() const;
QStringList readFileContent(const QString& filePath);
QList<QStringList> parseExcelData(QString filePath);
// UI Components
QGroupBox* m_pSourceGroup;
QPushButton* m_pLoadTxtButton;
QPushButton* m_pLoadExcelButton;
QPushButton* m_pCopyButton;
QLineEdit* m_pFilePathEdit;
QPushButton* m_pBrowseButton;
// 最近打开的文件路径
QString m_sLastOpenedFilePath;
QGroupBox* m_pSeparatorGroup;
// 分隔符选项(使用复选框)
QCheckBox* m_pSpaceCheck;
QCheckBox* m_pTabCheck;
QLabel* m_pOtherLabel;
QLineEdit* m_pOtherSeparatorEdit;
QGroupBox* m_pInfoGroup;
QLabel* m_pInfoLabel;
QTableWidget* m_pColumnTable;
/*QStringList listTypeOptions;
QStringList listUnitOptions;*/
QMap<QString, QStringList> m_typeToUnitOptions; // Type到单位选项的映射
QMap<QString, QString> m_typeToDefaultUnit; // Type到默认单位的映射
QStringList m_allTypeOptions; // 存储所有可用的Type选项
QPushButton* m_pOkButton;
QPushButton* m_pCancelButton;
};
#endif // NMWXDFNLOADFROMFILE_H