EvalSpinBox new "calculationVisible" property

This commit is contained in:
2020-11-11 22:29:08 +03:00
parent 925437f809
commit 649ec22a11
3 changed files with 14 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ EvalSpinBox::EvalSpinBox(QWidget * parent): QAbstractSpinBox(parent) {
cw->setToolTip(tr("Clear"));
cw->hide();
cw_visible = false;
calc_visible = true;
//lineEdit()->setStyleSheet("color: darkgreen;");
//lineEdit()->setText(eval.expression() + " -> " + QString::number(value(), 'G', 10));
cw->installEventFilter(this);
@@ -277,7 +278,8 @@ void EvalSpinBox::focusOutEvent(QFocusEvent * event) {
label->setText("<html><head/><body><p><span style=\"color:#005500;\">-&gt; " + QString::number(value(), 'G', 10) + "</span></p></body></html>");
else
label->setText("");
label->show();
if (calc_visible)
label->show();
lineEdit()->blockSignals(true);
if (!eval->isCorrect()) lineEdit()->setStyleSheet("color: darkred;");
else status->hide();
@@ -338,3 +340,9 @@ void EvalSpinBox::setClearButtonVisible(bool visible) {
cw->setVisible((eval->expression() != dt || (dt.isEmpty() && eval->expression() == "0")) && cw_visible);
resizeIcons();
}
void EvalSpinBox::setCalculationVisible(bool visible) {
calc_visible = visible;
setExpression_();
}