菜单优化

dev-LayerStyle
karlis 2023-03-17 17:14:09 +08:00
parent 9e4cdb3a63
commit 24f8daf1fd
2 changed files with 10 additions and 9 deletions

View File

@ -61,13 +61,13 @@ void InfoDisplayWidget::generateLayerForm()
emit requireRefreshElementWidget(); emit requireRefreshElementWidget();
emit requireRefreshPreview(); emit requireRefreshPreview();
}); });
scaleX->setValidator(new QDoubleValidator(0.001, 1000, 4, this)); scaleX->setValidator(new QDoubleValidator(-1000, 1000, 4, this));
connect(scaleX, &QLineEdit::textChanged, [=](QString content) { connect(scaleX, &QLineEdit::textChanged, [=](QString content) {
this->displayLayer->property.scale = {content.toDouble(), this->displayLayer->property.scale.y()}; this->displayLayer->property.scale = {content.toDouble(), this->displayLayer->property.scale.y()};
emit requireRefreshElementWidget(); emit requireRefreshElementWidget();
emit requireRefreshPreview(); emit requireRefreshPreview();
}); });
scaleY->setValidator(new QDoubleValidator(0.001, 1000, 4, this)); scaleY->setValidator(new QDoubleValidator(-1000, 1000, 4, this));
connect(scaleY, &QLineEdit::textChanged, [=](QString content) { connect(scaleY, &QLineEdit::textChanged, [=](QString content) {
this->displayLayer->property.scale = {this->displayLayer->property.scale.x(), content.toDouble()}; this->displayLayer->property.scale = {this->displayLayer->property.scale.x(), content.toDouble()};
emit requireRefreshElementWidget(); emit requireRefreshElementWidget();

View File

@ -78,13 +78,14 @@ void LayerTreeWidget::popMenu(const QPoint &pos)
emit requireRefreshPreview(); emit requireRefreshPreview();
}); });
menu.addAction(QString::fromLocal8Bit("ÖØÃüÃû"), this, &LayerTreeWidget::onRenameEvent); menu.addAction(QString::fromLocal8Bit("ÖØÃüÃû"), this, &LayerTreeWidget::onRenameEvent);
menu.addAction(QString::fromLocal8Bit("删除(保留子节点)"), this, [this]() { if(typeid(*layer) == typeid(FolderLayerWrapper))
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>(); menu.addAction(QString::fromLocal8Bit("删除(保留子节点)"), this, [this]() {
layer->delSelf(); auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
layer->getParent()->removeChild(layer); layer->delSelf();
this->refresh(); layer->getParent()->removeChild(layer);
emit requireRefreshPreview(); this->refresh();
}); emit requireRefreshPreview();
});
} }
if (typeid(*layer) == typeid(FolderLayerWrapper) && ((FolderLayerWrapper*)layer)->getReferencedBy() == -1) { if (typeid(*layer) == typeid(FolderLayerWrapper) && ((FolderLayerWrapper*)layer)->getReferencedBy() == -1) {
menu.addAction(QString::fromLocal8Bit("´´½¨×éºÏÔªËØ"), this, [this]() { menu.addAction(QString::fromLocal8Bit("´´½¨×éºÏÔªËØ"), this, [this]() {