优化LayerInfo的输入体验 | #29
parent
7667525287
commit
bbe0d49fc4
|
@ -24,47 +24,52 @@ InfoDisplayWidget::InfoDisplayWidget(QWidget* parent) :QWidget(parent)
|
|||
ui.scaleY->setLabel(("垂直缩放"));
|
||||
ui.rotation->setValidator(new QIntValidator(-360, 360, this));
|
||||
//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)
|
||||
return;
|
||||
this->displayLayer->property.setRotation(content.toDouble());
|
||||
emit triggerCentralRefresh();
|
||||
ui.rotation->setText(content);
|
||||
});
|
||||
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)
|
||||
return;
|
||||
this->displayLayer->property.offset = { content.toDouble(), this->displayLayer->property.offset.y() };
|
||||
emit triggerCentralRefresh();
|
||||
ui.offsetX->setText(content);
|
||||
});
|
||||
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)
|
||||
return;
|
||||
this->displayLayer->property.offset = { this->displayLayer->property.offset.x(), content.toDouble() };
|
||||
emit triggerCentralRefresh();
|
||||
ui.offsetY->setText(content);
|
||||
});
|
||||
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)
|
||||
return;
|
||||
this->displayLayer->property.scale = { content.toDouble(), this->displayLayer->property.scale.y() };
|
||||
emit triggerCentralRefresh();
|
||||
ui.scaleX->setText(content);
|
||||
});
|
||||
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)
|
||||
return;
|
||||
this->displayLayer->property.scale = { this->displayLayer->property.scale.x(), content.toDouble() };
|
||||
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)
|
||||
return;
|
||||
this->displayLayer->property.flipX = state;
|
||||
emit triggerCentralRefresh();
|
||||
});
|
||||
connect(ui.flipY, &QtMaterialCheckBox::toggled, [=](bool state) {
|
||||
connect(ui.flipY, &QtMaterialCheckBox::toggled, [&](bool state) {
|
||||
if (state == this->displayLayer->property.flipY)
|
||||
return;
|
||||
this->displayLayer->property.flipY = state;
|
||||
|
|
Loading…
Reference in New Issue