改进计数器编辑、预览状态和行为;修复移除source属性的影响、修改自检期间粘度计每次工作时间、更新翻译
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include "scene/PicCounterItem.h"
|
||||
#include <qmath.h>
|
||||
|
||||
CounterVarSet::CounterVarSet(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -25,6 +26,30 @@ void CounterVarSet::init()
|
||||
// 连接信号槽
|
||||
connect(ui->checkBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot);
|
||||
connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot);
|
||||
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, this, [this](int i){
|
||||
|
||||
if(ui->cb_digits->currentIndex() == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSpinBox *endValueBox = nullptr;
|
||||
if(ui->tabWidget->widget(i) == ui->cnt1Tab && ui->radioButtonVar1->isChecked()) {
|
||||
endValueBox = ui->spinBoxCnt1EndValue;
|
||||
}
|
||||
else if(ui->tabWidget->widget(i) == ui->cnt2Tab && ui->radioButtonVar2->isChecked()) {
|
||||
endValueBox = ui->spinBoxCnt2EndValue;
|
||||
}
|
||||
|
||||
if(!endValueBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
int digits = ui->cb_digits->itemText(ui->cb_digits->currentIndex()).toInt();
|
||||
int maxValue = qPow(10, digits) - 1;
|
||||
endValueBox->setMaximum(maxValue);
|
||||
endValueBox->setValue(maxValue);
|
||||
});
|
||||
}
|
||||
|
||||
void CounterVarSet::buttonClickedSlot()
|
||||
@@ -52,6 +77,20 @@ CounterViewModel CounterVarSet::getCounterConfig()
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
void CounterVarSet::onDigitsChanged(int digits)
|
||||
{
|
||||
int maxValue = qPow(10, digits) - 1;
|
||||
|
||||
QSpinBox* endValueBox = nullptr;
|
||||
if(ui->radioButtonVar1->isChecked())
|
||||
endValueBox = ui->spinBoxCnt1EndValue;
|
||||
else
|
||||
endValueBox = ui->spinBoxCnt2EndValue;
|
||||
|
||||
endValueBox->setMaximum(maxValue);
|
||||
endValueBox->setValue(maxValue);
|
||||
}
|
||||
|
||||
void CounterVarSet::setCounterConfig(CounterViewModel viewModel)
|
||||
{
|
||||
m_vm = viewModel;
|
||||
|
||||
Reference in New Issue
Block a user