git-svn-id: svn://db.shs.com.ru/libs@646 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-12-03 22:33:11 +00:00
parent 2d2552ff63
commit f510e8e957
10 changed files with 364 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ EvalSpinBox::EvalSpinBox(QWidget * parent): QAbstractSpinBox(parent) {
status = new QWidget(lineEdit());
cw = new QWidget(lineEdit());
label = new QLabel(lineEdit());
precision_ = -1;
// label->hide();
clear_im.load(":/icons/edit-clear-locationbar-rtl.png");
icon_ok.load(":/icons/dialog-ok-apply.png");
@@ -155,7 +156,7 @@ void EvalSpinBox::setExpression_() {
/*if (eval.expression() == "0") lineEdit()->clear();
else*/ lineEdit()->setText(eval.expression());
eval.evaluate();
if (td) lineEdit()->setText(QString::number(value(), 'G', 10));
if (td) lineEdit()->setText(QString::number(value(), 'G', precision_ > 0 ? precision_ : 16));
status->setToolTip("OK -> " + QString::number(value(), 'G', 10));
icon = icon_ok;
} else {
@@ -199,7 +200,7 @@ void EvalSpinBox::setExpression(const QString & expr) {
void EvalSpinBox::setValue(double val) {
lineEdit()->setText(QString::number(val, 'G', 16));
lineEdit()->setText(QString::number(val, 'G', precision_ > 0 ? precision_ : 16));
//if (val == 0) lineEdit()->clear();
cw->setVisible(text() != dt && cw_visible);
setExpression_();