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/Src/nmNum/nmGUI/nmGUIComponentLineEdit.cpp

35 lines
889 B
C++

#include "nmGUIComponentLineEdit.h"
#include "nmDataAttribute.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
Q_DECLARE_METATYPE(int *)
Q_DECLARE_METATYPE(double *)
Q_DECLARE_METATYPE(QString *)
nmGUIComponentLineEdit::nmGUIComponentLineEdit(nmDataAttribute* pOriginValue,
bool enable, QWidget *parent) :
nmGUIComponentBase(pOriginValue, enable, parent) {
this->initUI();
this->initInitValue();
this->setStyleSheet("{ background-color: red; }");
}
void nmGUIComponentLineEdit::init() {
this->initUI();
this->initInitValue();
}
void nmGUIComponentLineEdit::setDisplayValue(double v)
{
double disp = nmDataAttribute::convertValue(v, m_baseUnit, m_currentUnit);
QLineEdit* le = qobject_cast<QLineEdit*>(m_pValueEdit);
if (le) {
le->setText(QString::number(disp, 'f', 3));
}
}