Compare commits
2 Commits
0b63e8e737
...
7e0e07292f
Author | SHA1 | Date |
---|---|---|
karlis | 7e0e07292f | |
karlis | b2f37cc4eb |
|
@ -212,16 +212,15 @@ QAction* LayerTreeWidget::getPromoteUpAction()
|
|||
QAction* action = new QAction(QString::fromLocal8Bit("ÌáÉý (experimental)"), this);
|
||||
QMenu* optionMenu = new QMenu();
|
||||
QList<QAction*> optionList;
|
||||
std::vector<LayerWrapper*> layers;
|
||||
std::vector<FolderLayerWrapper*> 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();
|
||||
if (layer->getParent() == nullptr)
|
||||
break;
|
||||
layers.push_back(layer);
|
||||
layers.push_back(dynamic_cast<FolderLayerWrapper*>(layer));
|
||||
}
|
||||
reverse(layers.begin(), layers.end());
|
||||
if (layers.size() == 0)
|
||||
|
@ -233,12 +232,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*, LayerWrapper*>({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*, FolderLayerWrapper*>({this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>(), layer})));
|
||||
connect(option, &QAction::triggered, this, [this, option]() {
|
||||
auto pair = option->data().value<std::pair<LayerWrapper*, LayerWrapper*>>();
|
||||
auto pair = option->data().value<std::pair<LayerWrapper*, FolderLayerWrapper*>>();
|
||||
auto layer = pair.first;
|
||||
auto parent = pair.second->getParent();
|
||||
auto parent = pair.second;
|
||||
this->moveLayer(layer, parent);
|
||||
});
|
||||
optionList.append(option);
|
||||
|
|
Loading…
Reference in New Issue