-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added Expand/Collapse API to GroupLayer #4009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,9 @@ | |
| #include "addremovetileset.h" | ||
| #include "editablemap.h" | ||
| #include "scriptmanager.h" | ||
| #include "documentmanager.h" | ||
| #include "mapeditor.h" | ||
| #include "layerdock.h" | ||
|
|
||
| #include <QCoreApplication> | ||
|
|
||
|
|
@@ -136,6 +139,20 @@ void EditableGroupLayer::addLayer(EditableLayer *editableLayer) | |
| insertLayerAt(layerCount(), editableLayer); | ||
| } | ||
|
|
||
| inline bool EditableGroupLayer::isExpanded() const | ||
| { | ||
| auto documentManager = DocumentManager::instance(); | ||
| auto mapEditor = static_cast<MapEditor*>(documentManager->editor(Document::MapDocumentType)); | ||
| return mapEditor->layerDock()->isExpanded(groupLayer()); | ||
| } | ||
|
|
||
| inline void EditableGroupLayer::setExpanded(bool expanded) | ||
| { | ||
| auto documentManager = DocumentManager::instance(); | ||
| auto mapEditor = static_cast<MapEditor*>(documentManager->editor(Document::MapDocumentType)); | ||
| mapEditor->layerDock()->setExpanded(groupLayer(), expanded); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert your changes to |
||
|
|
||
| } // namespace Tiled | ||
|
|
||
| #include "moc_editablegrouplayer.cpp" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| #pragma once | ||
|
|
||
| #include "mapdocument.h" | ||
| #include "editablegrouplayer.h" | ||
|
|
||
| #include <QDockWidget> | ||
| #include <QTreeView> | ||
|
|
@@ -54,6 +55,11 @@ class LayerDock : public QDockWidget | |
| */ | ||
| void setMapDocument(MapDocument *mapDocument); | ||
|
|
||
| Q_INVOKABLE bool isExpanded(EditableGroupLayer *layer) const { return isExpanded(layer->groupLayer()); }; | ||
| Q_INVOKABLE void setExpanded(EditableGroupLayer *layer, bool expanded) { setExpanded(layer->groupLayer(), expanded); }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These functions need to check at the very least that |
||
| bool isExpanded(GroupLayer *layer) const; | ||
| void setExpanded(GroupLayer *layer, bool expanded); | ||
|
|
||
| protected: | ||
| void changeEvent(QEvent *e) override; | ||
|
|
||
|
|
@@ -90,6 +96,8 @@ class LayerView : public QTreeView | |
|
|
||
| void editLayerModelIndex(const QModelIndex &layerModelIndex); | ||
|
|
||
| QAbstractProxyModel *proxyModel() { return mProxyModel; } | ||
|
|
||
| protected: | ||
| bool event(QEvent *event) override; | ||
| void contextMenuEvent(QContextMenuEvent *event) override; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,8 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include "editableobjectgroup.h" | ||
|
|
||
| #include <QDockWidget> | ||
| #include <QMap> | ||
|
|
||
|
|
@@ -41,6 +43,11 @@ class ObjectsDock : public QDockWidget | |
|
|
||
| void setMapDocument(MapDocument *mapDoc); | ||
|
|
||
| Q_INVOKABLE bool isExpanded(EditableObjectGroup *layer) const { return isExpanded(layer->objectGroup()); }; | ||
| Q_INVOKABLE void setExpanded(EditableObjectGroup *layer, bool expanded) { setExpanded(layer->objectGroup(), expanded); }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here regarding |
||
| bool isExpanded(ObjectGroup *layer) const; | ||
| void setExpanded(ObjectGroup *layer, bool expanded); | ||
|
|
||
| protected: | ||
| void changeEvent(QEvent *e) override; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid changing this file at all. I realize these are remnants of earlier changes.