#ifndef FORM_DEVICECONFIG_H #define FORM_DEVICECONFIG_H #include #include #include #include "sane/sane_ex.h" struct DeviceConfig { DeviceConfig() { valueType = 0; intValue = 0; doubleValue = 0; boolValue = false; rangeType = 0; intValueMin = 0; intValueMax = 0; doubleValueMin = 0; doubleValueMax = 0; } // 配置名 std::string name; std::string title; int valueType; // 0-无,1-字符串,2-整型,3-浮点,4-布尔 std::string stringValue; int intValue; double doubleValue; bool boolValue; int rangeType; // 0-无,1-字符串列表,2-整型列表,3-浮点数列表,4-整型范围,5-浮点数范围 std::vector stringValueList; std::vector intValueList; std::vector doubleValueList; int intValueMin; int intValueMax; double doubleValueMin; double doubleValueMax; }; struct DeviceConfigsGroup { std::string groupTitle; std::vector deviceConfigs; }; class Form_DeviceConfig : public QWidget { Q_OBJECT public: explicit Form_DeviceConfig(SANE_Handle devHandle, const std::vector& deviceConfigs, QWidget *parent = nullptr); ~Form_DeviceConfig(); std::vector GetDeviceConfigs(); private: void ResetDevice(SANE_Handle devHandle); void CreateUI(const std::vector& deviceConfigs); private: std::vector m_deviceConfigsGroups; }; #endif // FORM_DEVICECONFIG_H