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.
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include "iUnit_global.h"
|
|
|
|
|
|
|
|
|
|
class iUnitGroup;
|
|
|
|
|
class QHBoxLayout;
|
|
|
|
|
class QLineEdit;
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QLabel;
|
|
|
|
|
|
|
|
|
|
// 专门封装的单位显示组件,目前用的地方不多
|
|
|
|
|
class I_UNITSHARED_EXPORT iUnitControl : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 创建时需输入一个单位信息,即iUnitGroup类的一个对象
|
|
|
|
|
iUnitControl(iUnitGroup* pUnitGroup);
|
|
|
|
|
~iUnitControl();
|
|
|
|
|
|
|
|
|
|
void initUI();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
void initUnitCbx();
|
|
|
|
|
|
|
|
|
|
double getValue(); //获得当前单位制下的数值
|
|
|
|
|
void setValue(double value); //修改当前单位制下的数值
|
|
|
|
|
bool setCurrentUnit(QString sUnit); //修改当前单位
|
|
|
|
|
bool setCurrentUnit(int nUnitIndex); //修改当前单位
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
|
|
void slotTextChanged(QString s); //手动改参数对应的槽函数
|
|
|
|
|
void slotCbxIndexChanged(int index); //单位改变对应的槽
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
QLabel* m_pItemTag;
|
|
|
|
|
QLineEdit* m_pItemEdit;
|
|
|
|
|
QComboBox* m_pCbxUnits;
|
|
|
|
|
iUnitGroup* m_pUnitGroup;
|
|
|
|
|
|
|
|
|
|
double m_fRawValue; //记录输入的数值,用于转换
|
|
|
|
|
QString m_sRawUnit;
|
|
|
|
|
};
|