Compare commits

...

2 Commits

Author SHA1 Message Date
karlis 2f776d1fdc Merge branch 'main' of http://101.34.228.45:3000/BigC/ArchitectureColoredPainting 2023-03-24 13:59:09 +08:00
karlis bbe0d49fc4 优化LayerInfo的输入体验 | #29 2023-03-24 13:59:07 +08:00
1 changed files with 12 additions and 7 deletions

View File

@ -24,47 +24,52 @@ InfoDisplayWidget::InfoDisplayWidget(QWidget* parent) :QWidget(parent)
ui.scaleY->setLabel(("垂直缩放")); ui.scaleY->setLabel(("垂直缩放"));
ui.rotation->setValidator(new QIntValidator(-360, 360, this)); ui.rotation->setValidator(new QIntValidator(-360, 360, this));
//ui.styleList->setDisabled(true); //ui.styleList->setDisabled(true);
connect(ui.rotation, &QLineEdit::textChanged, [=](const QString& content) { connect(ui.rotation, &QLineEdit::textEdited, [&](const QString& content) {
if (fabs(content.toDouble() - this->displayLayer->property.rotation) < 1e-6) if (fabs(content.toDouble() - this->displayLayer->property.rotation) < 1e-6)
return; return;
this->displayLayer->property.setRotation(content.toDouble()); this->displayLayer->property.setRotation(content.toDouble());
emit triggerCentralRefresh(); emit triggerCentralRefresh();
ui.rotation->setText(content);
}); });
ui.offsetX->setValidator(new QDoubleValidator(-10000, 10000, 2, this)); ui.offsetX->setValidator(new QDoubleValidator(-10000, 10000, 2, this));
connect(ui.offsetX, &QLineEdit::textChanged, [=](const QString& content) { connect(ui.offsetX, &QLineEdit::textEdited, [&](const QString& content) {
if (fabs(content.toDouble() - this->displayLayer->property.offset.x()) < 1e-6) if (fabs(content.toDouble() - this->displayLayer->property.offset.x()) < 1e-6)
return; return;
this->displayLayer->property.offset = { content.toDouble(), this->displayLayer->property.offset.y() }; this->displayLayer->property.offset = { content.toDouble(), this->displayLayer->property.offset.y() };
emit triggerCentralRefresh(); emit triggerCentralRefresh();
ui.offsetX->setText(content);
}); });
ui.offsetY->setValidator(new QDoubleValidator(-10000, 10000, 2, this)); ui.offsetY->setValidator(new QDoubleValidator(-10000, 10000, 2, this));
connect(ui.offsetY, &QLineEdit::textChanged, [=](const QString& content) { connect(ui.offsetY, &QLineEdit::textEdited, [&](const QString& content) {
if (fabs(content.toDouble() - this->displayLayer->property.offset.y()) < 1e-6) if (fabs(content.toDouble() - this->displayLayer->property.offset.y()) < 1e-6)
return; return;
this->displayLayer->property.offset = { this->displayLayer->property.offset.x(), content.toDouble() }; this->displayLayer->property.offset = { this->displayLayer->property.offset.x(), content.toDouble() };
emit triggerCentralRefresh(); emit triggerCentralRefresh();
ui.offsetY->setText(content);
}); });
ui.scaleX->setValidator(new QDoubleValidator(0, 10000, 6, this)); ui.scaleX->setValidator(new QDoubleValidator(0, 10000, 6, this));
connect(ui.scaleX, &QLineEdit::textChanged, [=](const QString& content) { connect(ui.scaleX, &QLineEdit::textEdited, [&](const QString& content) {
if (fabs(content.toDouble() - this->displayLayer->property.scale.x()) < 1e-6) if (fabs(content.toDouble() - this->displayLayer->property.scale.x()) < 1e-6)
return; return;
this->displayLayer->property.scale = { content.toDouble(), this->displayLayer->property.scale.y() }; this->displayLayer->property.scale = { content.toDouble(), this->displayLayer->property.scale.y() };
emit triggerCentralRefresh(); emit triggerCentralRefresh();
ui.scaleX->setText(content);
}); });
ui.scaleY->setValidator(new QDoubleValidator(0, 10000, 6, this)); ui.scaleY->setValidator(new QDoubleValidator(0, 10000, 6, this));
connect(ui.scaleY, &QLineEdit::textChanged, [=](const QString& content) { connect(ui.scaleY, &QLineEdit::textEdited, [&](const QString& content) {
if (fabs(content.toDouble() - this->displayLayer->property.scale.y()) < 1e-6) if (fabs(content.toDouble() - this->displayLayer->property.scale.y()) < 1e-6)
return; return;
this->displayLayer->property.scale = { this->displayLayer->property.scale.x(), content.toDouble() }; this->displayLayer->property.scale = { this->displayLayer->property.scale.x(), content.toDouble() };
emit triggerCentralRefresh(); emit triggerCentralRefresh();
ui.scaleY->setText(content);
}); });
connect(ui.flipX, &QtMaterialCheckBox::toggled, [=](bool state) { connect(ui.flipX, &QtMaterialCheckBox::toggled, [&](bool state) {
if (state == this->displayLayer->property.flipX) if (state == this->displayLayer->property.flipX)
return; return;
this->displayLayer->property.flipX = state; this->displayLayer->property.flipX = state;
emit triggerCentralRefresh(); emit triggerCentralRefresh();
}); });
connect(ui.flipY, &QtMaterialCheckBox::toggled, [=](bool state) { connect(ui.flipY, &QtMaterialCheckBox::toggled, [&](bool state) {
if (state == this->displayLayer->property.flipY) if (state == this->displayLayer->property.flipY)
return; return;
this->displayLayer->property.flipY = state; this->displayLayer->property.flipY = state;