Compare commits
No commits in common. "ca8d68fe9307056f2444da8be1db286817a69caf" and "6508f54333497ef665dfc4262017f9cd4248552e" have entirely different histories.
ca8d68fe93
...
6508f54333
|
@ -33,7 +33,6 @@ PixelPath LayerWrapper::getCache()
|
|||
LayerWrapper::LayerWrapper(QJsonObject json, FolderLayerWrapper*parent)
|
||||
{
|
||||
this->parent = parent;
|
||||
this->qTreeWidgetItem = new QTreeWidgetItem();
|
||||
auto transformJson = json.value("transform").toObject();
|
||||
property.name = json.value("name").toString();
|
||||
property.offset = {transformJson.value("offset").toObject().value("x").toDouble(),
|
||||
|
@ -120,22 +119,22 @@ void LayerWrapper::setParent(FolderLayerWrapper* newParent)
|
|||
void FolderLayerWrapper::removeAllChild()
|
||||
{
|
||||
children.clear();
|
||||
qTreeWidgetItem->takeChildren();
|
||||
qTreeWidgetItem.takeChildren();
|
||||
}
|
||||
|
||||
void LayerWrapper::del() {
|
||||
qDebug() << "LayerWrapper::del()";
|
||||
if (parent != nullptr){
|
||||
qTreeWidgetItem->takeChildren();
|
||||
parent->qTreeWidgetItem->removeChild(qTreeWidgetItem);
|
||||
qTreeWidgetItem.takeChildren();
|
||||
parent->qTreeWidgetItem.removeChild(&qTreeWidgetItem);
|
||||
}
|
||||
}
|
||||
|
||||
void LayerWrapper::delSelf() {
|
||||
qDebug() << "LayerWrapper::delSelf()";
|
||||
if (parent != nullptr) {
|
||||
qTreeWidgetItem->takeChildren();
|
||||
parent->qTreeWidgetItem->removeChild(qTreeWidgetItem);
|
||||
qTreeWidgetItem.takeChildren();
|
||||
parent->qTreeWidgetItem.removeChild(&qTreeWidgetItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +154,7 @@ void FolderLayerWrapper::delSelf() {
|
|||
qDebug() << this;
|
||||
for (auto& child : this->children) {
|
||||
this->parent->addChild(child);
|
||||
this->parent->qTreeWidgetItem->addChild(child.get()->qTreeWidgetItem);
|
||||
this->parent->qTreeWidgetItem.addChild(&child.get()->qTreeWidgetItem);
|
||||
child->setParent(this->parent);
|
||||
}
|
||||
while (!this->children.empty()) {
|
||||
|
@ -167,18 +166,18 @@ void FolderLayerWrapper::delSelf() {
|
|||
|
||||
QTreeWidgetItem* LayerWrapper::getQTreeItem()
|
||||
{
|
||||
this->qTreeWidgetItem->setText(0, this->property.name);
|
||||
this->qTreeWidgetItem->setData(0, Qt::UserRole, QVariant::fromValue(this));
|
||||
return this->qTreeWidgetItem;
|
||||
this->qTreeWidgetItem.setText(0, this->property.name);
|
||||
this->qTreeWidgetItem.setData(0, Qt::UserRole, QVariant::fromValue(this));
|
||||
return &this->qTreeWidgetItem;
|
||||
}
|
||||
|
||||
QTreeWidgetItem* FolderLayerWrapper::getQTreeItem()
|
||||
{
|
||||
while (this->qTreeWidgetItem->childCount() > 0) {
|
||||
this->qTreeWidgetItem->removeChild(this->qTreeWidgetItem->child(0));
|
||||
while (this->qTreeWidgetItem.childCount() > 0) {
|
||||
this->qTreeWidgetItem.removeChild(this->qTreeWidgetItem.child(0));
|
||||
}
|
||||
for (auto& child : this->children) {
|
||||
this->qTreeWidgetItem->addChild(child->getQTreeItem());
|
||||
this->qTreeWidgetItem.addChild(child->getQTreeItem());
|
||||
}
|
||||
return LayerWrapper::getQTreeItem();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class LayerWrapper
|
|||
PixelPath cache;
|
||||
|
||||
public:
|
||||
QTreeWidgetItem* qTreeWidgetItem;
|
||||
QTreeWidgetItem qTreeWidgetItem;
|
||||
struct SimpleProperty
|
||||
{
|
||||
QString name = "";
|
||||
|
|
|
@ -51,7 +51,7 @@ void LayerTreeWidget::popMenu(const QPoint &pos)
|
|||
else
|
||||
newLayer = new LeafLayerWrapper(jsonObj, this->elementManager, folderLayer);
|
||||
folderLayer->addChild(std::shared_ptr<LayerWrapper>(newLayer));
|
||||
folderLayer->qTreeWidgetItem->addChild(newLayer->getQTreeItem());
|
||||
folderLayer->qTreeWidgetItem.addChild(newLayer->getQTreeItem());
|
||||
qDebug() << jsonObj<<"----------------------";
|
||||
this->refresh();
|
||||
emit requireRefreshPreview();
|
||||
|
|
Loading…
Reference in New Issue