[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri Mar 18 22:09:43 CET 2005
CVS commit by staikos:
allow equations in the scalar editor
M +1 -0 scalarselector.ui 1.12
M +11 -7 scalarselector.ui.h 1.12
--- kdeextragear-2/kst/kst/scalarselector.ui #1.11:1.12
@@ -96,4 +96,5 @@
<include location="global" impldecl="in implementation">qlistbox.h</include>
<include location="global" impldecl="in implementation">qtimer.h</include>
+ <include location="local" impldecl="in implementation">enodes.h</include>
<include location="local" impldecl="in implementation">scalarselector.ui.h</include>
</includes>
--- kdeextragear-2/kst/kst/scalarselector.ui.h #1.11:1.12
@@ -63,8 +63,6 @@ void ScalarSelector::update()
void ScalarSelector::createNewScalar()
{
- QDoubleValidator dv(this);
ScalarEditor *se = new ScalarEditor(this, "scalar editor");
- se->_value->setValidator(&dv);
int rc = se->exec();
if (rc == QDialog::Accepted) {
@@ -72,4 +70,8 @@ void ScalarSelector::createNewScalar()
double val = se->_value->text().toFloat(&ok);
+ if (!ok) {
+ val = Equation::interpret(se->_value->text().latin1(), &ok);
+ }
+
if (ok) {
KstScalarPtr s = new KstScalar(se->_name->text(), val);
@@ -82,5 +84,5 @@ void ScalarSelector::createNewScalar()
_editScalar->setEnabled(true);
} else {
- KMessageBox::sorry(0L, tr("Kst"), tr("Error saving your new scalar."));
+ KMessageBox::sorry(this, tr("Kst"), tr("Error saving your new scalar."));
}
}
@@ -91,5 +93,4 @@ void ScalarSelector::createNewScalar()
void ScalarSelector::editScalar()
{
- QDoubleValidator dv(this);
ScalarEditor *se = new ScalarEditor(this, "scalar editor");
@@ -102,5 +103,4 @@ void ScalarSelector::editScalar()
}
- se->_value->setValidator(&dv);
int rc = se->exec();
if (rc == QDialog::Accepted) {
@@ -108,4 +108,8 @@ void ScalarSelector::editScalar()
double val = se->_value->text().toFloat(&ok);
+ if (!ok) {
+ val = Equation::interpret(se->_value->text().latin1(), &ok);
+ }
+
if (ok) {
KstScalarPtr p = *KST::scalarList.findTag(se->_name->text());
@@ -124,5 +128,5 @@ void ScalarSelector::editScalar()
}
} else {
- KMessageBox::sorry(0L, tr("Kst"), tr("Error saving your new scalar."));
+ KMessageBox::sorry(this, tr("Kst"), tr("Error saving your new scalar."));
}
}
More information about the Kst
mailing list