20 #include "pdoublenuminput.h" 23 #include <knuminput.h> 25 #include "tqfloatinput.h" 34 PDoubleNumInput::PDoubleNumInput(MultiProperty *property, TQWidget *parent,
const char *name)
35 :PropertyWidget(property, parent, name)
37 TQHBoxLayout *l =
new TQHBoxLayout(
this, 0, 0);
39 m_edit =
new KDoubleNumInput(-999999.0, 999999.0, 0.0, 0.01, 2,
this);
40 m_edit->setLabel(TQString());
41 connect(m_edit, TQT_SIGNAL(valueChanged(
double)),
this, TQT_SLOT(updateProperty(
double)));
43 m_edit =
new TQFloatInput(-999999, 999999, 0.01, 2,
this );
44 connect(m_edit, TQT_SIGNAL(valueChanged(
int)),
this, TQT_SLOT(updateProperty(
int)));
46 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
56 return TQVariant(m_edit->value());
62 disconnect(m_edit, TQT_SIGNAL(valueChanged(
double)),
this, TQT_SLOT(updateProperty(
double)));
63 m_edit->setValue(value.toDouble());
64 connect(m_edit, TQT_SIGNAL(valueChanged(
double)),
this, TQT_SLOT(updateProperty(
double)));
66 disconnect(m_edit, TQT_SIGNAL(valueChanged(
int)),
this, TQT_SLOT(updateProperty(
int)));
67 m_edit->setValue(
int(value.toDouble()*pow(m_edit->digits(),10)));
68 connect(m_edit, TQT_SIGNAL(valueChanged(
int)),
this, TQT_SLOT(updateProperty(
int)));
74 void PDoubleNumInput::updateProperty(
double val)
78 void PDoubleNumInput::updateProperty(
int val)
81 TQString format = TQString(
"%.%1f").arg( m_edit->digits() );
82 TQString strVal = TQString().sprintf(format.latin1(),
83 (val/(float)pow(m_edit->digits(),10)) );
93 #include "pdoublenuminput.moc" virtual TQVariant value() const
Namespace which contain property editing classes.