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