Compare commits

..

No commits in common. "3edca0287b36e40340f754bc96aa8a337552e869" and "492f0a12d75a57c8eed6112d55a9cb2533fed577" have entirely different histories.

3 changed files with 3 additions and 77 deletions

View File

@ -309,8 +309,9 @@ void FolderLayerWrapper::paint(QPainter* painter, QTransform transform, bool for
return; return;
LayerWrapper::paint(painter, transform, force); LayerWrapper::paint(painter, transform, force);
transform = property.transform * transform; transform = property.transform * transform;
for (auto it = children.rbegin(); it != children.rend(); ++it) //qDebug() << transform;
(*it)->paint(painter, transform, force); for (auto& child : children)
child->paint(painter, transform, force);
} }
void LeafLayerWrapper::paint(QPainter* painter, QTransform transform, bool force) void LeafLayerWrapper::paint(QPainter* painter, QTransform transform, bool force)

View File

@ -3,7 +3,6 @@
#include <QMenu> #include <QMenu>
#include "./EditorWidgetComponent/LayerCreateWidget.h" #include "./EditorWidgetComponent/LayerCreateWidget.h"
#include <QTimer> #include <QTimer>
#include <QKeyEvent>
LayerTreeWidget::LayerTreeWidget(QWidget *parent) LayerTreeWidget::LayerTreeWidget(QWidget *parent)
{ {
@ -133,74 +132,3 @@ void LayerTreeWidget::onRenameEvent()
void LayerTreeWidget::refresh() { void LayerTreeWidget::refresh() {
this->root->refreshTreeItem(); 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();
}

View File

@ -9,8 +9,6 @@ class LayerTreeWidget : public QTreeWidget
private: private:
QTreeWidgetItem *selectedItem; QTreeWidgetItem *selectedItem;
LayerWrapper *copiedItem; LayerWrapper *copiedItem;
void pushUpLayer();
void pushDownLayer();
public: public:
ElementManager* elementManager; ElementManager* elementManager;
@ -19,7 +17,6 @@ class LayerTreeWidget : public QTreeWidget
void onRenameEvent(); void onRenameEvent();
void popMenu(const QPoint &pos); void popMenu(const QPoint &pos);
void refresh(); void refresh();
void keyPressEvent(QKeyEvent* event) override;
// void mouseDoubleClickEvent(QMouseEvent *event) override; // void mouseDoubleClickEvent(QMouseEvent *event) override;
// void onItemDoubleClicked(QTreeWidgetItem *item, int column = 0); // void onItemDoubleClicked(QTreeWidgetItem *item, int column = 0);