Compare commits

..

No commits in common. "7e0e07292f0f095be803427fea9aa05f76615caf" and "0b63e8e737ee8438aafc495cb319eac19e370259" have entirely different histories.

1 changed files with 8 additions and 7 deletions

View File

@ -212,15 +212,16 @@ QAction* LayerTreeWidget::getPromoteUpAction()
QAction* action = new QAction(QString::fromLocal8Bit("ÌáÉý (experimental)"), this);
QMenu* optionMenu = new QMenu();
QList<QAction*> optionList;
std::vector<FolderLayerWrapper*> layers;
std::vector<LayerWrapper*> layers;
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
layer = layer->getParent();
while (layer != nullptr)
{
if (layer->getParent() == nullptr)
break;
layer = layer->getParent();
layers.push_back(dynamic_cast<FolderLayerWrapper*>(layer));
if (layer->getParent() == nullptr)
break;
layers.push_back(layer);
}
reverse(layers.begin(), layers.end());
if (layers.size() == 0)
@ -232,12 +233,12 @@ QAction* LayerTreeWidget::getPromoteUpAction()
{
if (layer == nullptr)
continue;
QAction* option = new QAction(QString::fromLocal8Bit("ÌáÉýÖÁ ") + layer->property.name + QString::fromLocal8Bit(" ÏÂ"), this);
option->setData(QVariant::fromValue(std::pair<LayerWrapper*, FolderLayerWrapper*>({this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>(), layer})));
QAction* option = new QAction(QString::fromLocal8Bit("ÌáÉýÖÁ ") + layer->property.name + QString::fromLocal8Bit(" ͬ¼¶"), this);
option->setData(QVariant::fromValue(std::pair<LayerWrapper*, LayerWrapper*>({this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>(), layer})));
connect(option, &QAction::triggered, this, [this, option]() {
auto pair = option->data().value<std::pair<LayerWrapper*, FolderLayerWrapper*>>();
auto pair = option->data().value<std::pair<LayerWrapper*, LayerWrapper*>>();
auto layer = pair.first;
auto parent = pair.second;
auto parent = pair.second->getParent();
this->moveLayer(layer, parent);
});
optionList.append(option);