Compare commits
No commits in common. "69422ba96ad5e53ba3b6cd7cdcc655a648dae7c7" and "e48954175daff116bbc4c82501468b3f5a8aeb83" have entirely different histories.
69422ba96a
...
e48954175d
|
@ -182,12 +182,7 @@
|
|||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>图层名</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>关联图元</string>
|
||||
<string>图层树</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
|
|
|
@ -32,7 +32,6 @@ EditorWidgetItem::EditorWidgetItem(QString filePath,QWidget *parent) : QWidget(p
|
|||
connect(treeWidget, &LayerTreeWidget::requireRefreshPreview, this,
|
||||
&EditorWidgetItem::triggerRefreshPreview);
|
||||
connect(layerInfoDisplayWidget, &InfoDisplayWidget::requireSelfRefresh, layerInfoDisplayWidget, &InfoDisplayWidget::triggerSelfRefresh);
|
||||
connect(elementInfoDisplayWidget, &ElementPoolWidget::refreshLayerTree, treeWidget, &LayerTreeWidget::refresh);
|
||||
// &EditorWidget::triggerRefreshPreview);
|
||||
// test
|
||||
QFile settingFile;
|
||||
|
|
|
@ -67,7 +67,6 @@ void ElementPoolWidget::setElementManager(ElementManager* element)
|
|||
|
||||
void ElementPoolWidget::refresh() {
|
||||
this->setElementList(this->elementManager->elements);
|
||||
emit refreshLayerTree();
|
||||
// update();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
|
||||
signals:
|
||||
void elementSelected(GraphicElement* element);
|
||||
void refreshLayerTree();
|
||||
|
||||
public slots:
|
||||
int pictureItemClicked(QListWidgetItem* item);
|
||||
|
|
|
@ -192,39 +192,19 @@ 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;
|
||||
}
|
||||
|
||||
QTreeWidgetItem* LeafLayerWrapper::getQTreeItem()
|
||||
{
|
||||
if (this->qTreeWidgetItem == nullptr)
|
||||
this->qTreeWidgetItem = new QTreeWidgetItem();
|
||||
if (typeid(*wrappedElement) == typeid(GroupElement))
|
||||
{
|
||||
this->qTreeWidgetItem->setText(0, "@ "+this->property.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->qTreeWidgetItem->setText(0, this->property.name);
|
||||
}
|
||||
this->qTreeWidgetItem->setText(1,">> "+this->wrappedElement->name);
|
||||
this->qTreeWidgetItem->setTextColor(1, Qt::blue);
|
||||
return LayerWrapper::getQTreeItem();
|
||||
}
|
||||
|
||||
QTreeWidgetItem* FolderLayerWrapper::getQTreeItem()
|
||||
{
|
||||
for (auto& child : this->children) {
|
||||
while (this->qTreeWidgetItem->childCount() > 0) {
|
||||
this->qTreeWidgetItem->removeChild(this->qTreeWidgetItem->child(0));
|
||||
}
|
||||
for (auto& child : this->children) {
|
||||
this->qTreeWidgetItem->addChild(child->getQTreeItem());
|
||||
}
|
||||
this->qTreeWidgetItem->setText(0, this->property.name);
|
||||
auto ele = this->elementManager->getElementById(this->getReferencedBy());
|
||||
if (ele != nullptr)
|
||||
{
|
||||
this->qTreeWidgetItem->setText(1, "<< " + ele->name);
|
||||
this->qTreeWidgetItem->setTextColor(1, Qt::darkGreen);
|
||||
}
|
||||
return LayerWrapper::getQTreeItem();
|
||||
}
|
||||
|
||||
|
@ -338,36 +318,3 @@ void FolderLayerWrapper::collectDownReachable(std::set<LayerWrapper*>& reachable
|
|||
for (auto& child : children)
|
||||
child->collectDownReachable(reachable);
|
||||
}
|
||||
|
||||
void LayerWrapper::refreshTreeItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LeafLayerWrapper::refreshTreeItem()
|
||||
{
|
||||
if (typeid(*wrappedElement) == typeid(GroupElement))
|
||||
{
|
||||
this->qTreeWidgetItem->setText(0, "@ " + this->property.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->qTreeWidgetItem->setText(0, this->property.name);
|
||||
}
|
||||
this->qTreeWidgetItem->setText(1, ">> " + this->wrappedElement->name);
|
||||
this->qTreeWidgetItem->setTextColor(1, Qt::blue);
|
||||
}
|
||||
|
||||
void FolderLayerWrapper::refreshTreeItem()
|
||||
{
|
||||
for (auto& child : this->children) {
|
||||
child->refreshTreeItem();
|
||||
}
|
||||
this->qTreeWidgetItem->setText(0, this->property.name);
|
||||
auto ele = this->elementManager->getElementById(this->getReferencedBy());
|
||||
if (ele != nullptr)
|
||||
{
|
||||
this->qTreeWidgetItem->setText(1, "<< " + ele->name);
|
||||
this->qTreeWidgetItem->setTextColor(1, Qt::darkGreen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ class LayerWrapper
|
|||
~LayerWrapper() = default;
|
||||
virtual void collectUpReachable(std::set<LayerWrapper*>& reachable);
|
||||
virtual void collectDownReachable(std::set<LayerWrapper*>& reachable);
|
||||
virtual void refreshTreeItem();
|
||||
};
|
||||
|
||||
class FolderLayerWrapper : public LayerWrapper
|
||||
|
@ -95,7 +94,6 @@ class FolderLayerWrapper : public LayerWrapper
|
|||
int getReferencedBy()const;
|
||||
void paint(QPainter* painter, QTransform transform = QTransform(), bool ignoreSelected = false) override;
|
||||
void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
|
||||
void refreshTreeItem() override;
|
||||
};
|
||||
|
||||
class LeafLayerWrapper : public LayerWrapper
|
||||
|
@ -112,8 +110,6 @@ class LeafLayerWrapper : public LayerWrapper
|
|||
QJsonObject toJson() const override;
|
||||
void paint(QPainter* painter, QTransform transform = QTransform(), bool ignoreSelected = false) override;
|
||||
void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
|
||||
QTreeWidgetItem* getQTreeItem() override;
|
||||
void refreshTreeItem() override;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(LayerWrapper *)
|
||||
|
|
|
@ -9,7 +9,7 @@ LayerTreeWidget::LayerTreeWidget(QWidget *parent)
|
|||
this->selectedItem = nullptr;
|
||||
this->copiedItem = nullptr;
|
||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
this->setColumnWidth(0, 240);
|
||||
this->setHeaderLabel("Layer Content");
|
||||
connect(this, &QTreeWidget::customContextMenuRequested, this, &LayerTreeWidget::popMenu);
|
||||
connect(this, &QTreeWidget::currentItemChanged, [=](QTreeWidgetItem *currentItem) {
|
||||
if (this->selectedItem != nullptr) {
|
||||
|
@ -126,5 +126,9 @@ void LayerTreeWidget::onRenameEvent()
|
|||
}
|
||||
|
||||
void LayerTreeWidget::refresh() {
|
||||
this->root->refreshTreeItem();
|
||||
// if(this->root!=nullptr)
|
||||
//{
|
||||
// this->clear();
|
||||
// this->addTopLevelItem(this->root->getQTreeItem());
|
||||
//}
|
||||
}
|
Loading…
Reference in New Issue