Compare commits
No commits in common. "3edca0287b36e40340f754bc96aa8a337552e869" and "492f0a12d75a57c8eed6112d55a9cb2533fed577" have entirely different histories.
3edca0287b
...
492f0a12d7
|
@ -309,8 +309,9 @@ void FolderLayerWrapper::paint(QPainter* painter, QTransform transform, bool for
|
|||
return;
|
||||
LayerWrapper::paint(painter, transform, force);
|
||||
transform = property.transform * transform;
|
||||
for (auto it = children.rbegin(); it != children.rend(); ++it)
|
||||
(*it)->paint(painter, transform, force);
|
||||
//qDebug() << transform;
|
||||
for (auto& child : children)
|
||||
child->paint(painter, transform, force);
|
||||
}
|
||||
|
||||
void LeafLayerWrapper::paint(QPainter* painter, QTransform transform, bool force)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QMenu>
|
||||
#include "./EditorWidgetComponent/LayerCreateWidget.h"
|
||||
#include <QTimer>
|
||||
#include <QKeyEvent>
|
||||
|
||||
LayerTreeWidget::LayerTreeWidget(QWidget *parent)
|
||||
{
|
||||
|
@ -132,75 +131,4 @@ void LayerTreeWidget::onRenameEvent()
|
|||
|
||||
void LayerTreeWidget::refresh() {
|
||||
this->root->refreshTreeItem();
|
||||
}
|
||||
|
||||
void LayerTreeWidget::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (QApplication::keyboardModifiers() == Qt::ALT)
|
||||
{
|
||||
if (event->key() == Qt::Key_Up)
|
||||
{
|
||||
pushUpLayer();
|
||||
}
|
||||
else if (event->key() == Qt::Key_Down)
|
||||
{
|
||||
pushDownLayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayerTreeWidget::pushUpLayer()
|
||||
{
|
||||
if (this->selectedItem == nullptr)
|
||||
return;
|
||||
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
|
||||
if (layer == nullptr)
|
||||
return;
|
||||
auto parent = layer->getParent();
|
||||
int index = -1;
|
||||
for (int i = 0; i < parent->children.size(); i++)
|
||||
{
|
||||
if (parent->children[i].get() == layer)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1 || index == 0)
|
||||
return;
|
||||
auto temp = parent->children[index - 1];
|
||||
parent->children[index - 1] = parent->children[index];
|
||||
parent->children[index] = temp;
|
||||
layer->qTreeWidgetItem->parent()->removeChild(layer->qTreeWidgetItem);
|
||||
parent->qTreeWidgetItem->insertChild(index - 1, layer->qTreeWidgetItem);
|
||||
this->setCurrentItem(layer->qTreeWidgetItem);
|
||||
emit triggerCentralRefresh();
|
||||
}
|
||||
|
||||
void LayerTreeWidget::pushDownLayer()
|
||||
{
|
||||
if (this->selectedItem == nullptr)
|
||||
return;
|
||||
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
|
||||
if (layer == nullptr)
|
||||
return;
|
||||
auto parent = layer->getParent();
|
||||
int index = -1;
|
||||
for (int i = 0; i < parent->children.size(); i++)
|
||||
{
|
||||
if (parent->children[i].get() == layer)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1 || index == parent->children.size() - 1)
|
||||
return;
|
||||
auto temp = parent->children[index + 1];
|
||||
parent->children[index + 1] = parent->children[index];
|
||||
parent->children[index] = temp;
|
||||
layer->qTreeWidgetItem->parent()->removeChild(layer->qTreeWidgetItem);
|
||||
parent->qTreeWidgetItem->insertChild(index + 1, layer->qTreeWidgetItem);
|
||||
this->setCurrentItem(layer->qTreeWidgetItem);
|
||||
emit triggerCentralRefresh();
|
||||
}
|
|
@ -9,8 +9,6 @@ class LayerTreeWidget : public QTreeWidget
|
|||
private:
|
||||
QTreeWidgetItem *selectedItem;
|
||||
LayerWrapper *copiedItem;
|
||||
void pushUpLayer();
|
||||
void pushDownLayer();
|
||||
|
||||
public:
|
||||
ElementManager* elementManager;
|
||||
|
@ -19,7 +17,6 @@ class LayerTreeWidget : public QTreeWidget
|
|||
void onRenameEvent();
|
||||
void popMenu(const QPoint &pos);
|
||||
void refresh();
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
// void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
// void onItemDoubleClicked(QTreeWidgetItem *item, int column = 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue