NDEVR
API Documentation
SceneTree.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: SceneTree
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/QTModelManagerView.h>
35#include <QTreeWidget>
36#include <QItemDelegate>
37class QPoint;
38class QPropertyAnimation;
39namespace NDEVR
40{
41 class Button;
47 class SceneTree;
53 class NDEVR_API SceneTree : public QTreeView
54 {
55 Q_OBJECT
56 public:
62 explicit SceneTree(QTModelManager* manager, QWidget* parent = nullptr);
68 explicit SceneTree(QTModelManagerView* view, QWidget* parent = nullptr);
70 void initialize();
71 bool event(QEvent* e) override;
81 void setVisibleFilter(const std::function<bool(const Model&)>& filter);
86 void setIsRootFilter(const std::function<bool(const Model&)>& filter);
87 void selectionChanged(const QItemSelection& selected, const QItemSelection&) override;
94 void setCustomHeader(const TranslatedString& header_title, const StringView& header_icon = StringView(), bool allow_click = true);
99 void setRootModels(const Buffer<UUID>& ids);
104 void setCustomSizeHint(const QSize& size);
109 void setShowMaterials(bool show_materials);
110 void resizeEvent(QResizeEvent* size) override;
116 void createContextMenu(const Buffer<UUID>& ids, const QPoint &pos);
122 public slots:
128 void updateFocus(UUID id, bool focussed);
138 void updateExpanded(const QModelIndex& index);
139 //bool isIndexHidden(const QModelIndex & index) const override;
145 void updateSelection(Buffer<UUID> ids, bool selected);
150 void contextMenu(const QPoint &pos);
151 protected slots:
156 void onExpandedSlot(const QModelIndex& index);
161 void onCollapsedSlot(const QModelIndex& index);
162 protected:
164 void setup();
165 QSize sizeHint() const override;
166 private:
167 QMenu* m_menu = nullptr;
168 QSize m_custom_size_hint;
169 ProxyModelViewFilter* m_design_model = nullptr;
170 SceneTreeModelDelegate* m_model_delegate = nullptr;
171 Button* m_project_settings_button = nullptr;
172 bool auto_expanding = false;
173 bool m_allow_header_click = true;
174 bool m_ignore_expand_signal = false;
175 };
176}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core widget that allows the user to click one of many button types.
Definition Button.h:68
Sets up a button to be a combobox with the various snap locations of a camera.
A class for easily showing or hiding a Model in 3D space.
A dialog designed to allow the user to navigate a filesytem and select or create one or more files or...
A core class that represents a node on model hierarchy.
Definition Model.h:292
Filters and sorts Models from a ModelManager for views such as in a table or in a tree view.
A Qt compatible ItemModel for interfacing with a DesignObjectLookup.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Responsible for rendering an entry into a SceneTree widget.
Shows all objects in a QTModelManager in a tree hierarchy view that allows for user interaction.
Definition SceneTree.h:54
QTModelManager * manager() const
Retrieves the model manager used by this tree.
void setShowMaterials(bool show_materials)
Sets whether materials are shown as child items in the tree.
void setup()
Sets up the tree view connections and model.
void setCustomHeader(const TranslatedString &header_title, const StringView &header_icon=StringView(), bool allow_click=true)
Sets a custom header for the tree view.
void initialize()
Initializes the tree view, connecting signals and setting up delegates.
void setVisibleFilter(const std::function< bool(const Model &)> &filter)
Sets a filter function that determines which models are visible in the tree.
void createContextMenu(const Buffer< UUID > &ids, const QPoint &pos)
Creates and displays a context menu for the given objects at the specified position.
void setRootModels(const Buffer< UUID > &ids)
Sets the root models displayed in the tree.
void contextMenu(const QPoint &pos)
Opens a context menu at the given position.
Buffer< UUID > selectedObjects() const
Retrieves the UUIDs of all currently selected objects.
void setCustomSizeHint(const QSize &size)
Sets a custom size hint for the tree widget.
void updateSelection(Buffer< UUID > ids, bool selected)
Updates the selection state of objects in the tree.
SceneTree(QTModelManagerView *view, QWidget *parent=nullptr)
Constructs a scene tree from a model manager view.
void updateFocus(UUID id, bool focussed)
Updates the focus state of an object in the tree.
void setIsRootFilter(const std::function< bool(const Model &)> &filter)
Sets a filter function that determines which models appear as root nodes.
void onCollapsedSlot(const QModelIndex &index)
Handles item collapse events.
void updateExpanded(const QModelIndex &index)
Updates the expanded state for a given index.
void onExpandedSlot(const QModelIndex &index)
Handles item expansion events.
SceneTree(QTModelManager *manager, QWidget *parent=nullptr)
Constructs a scene tree from a model manager.
void updateModel(UUID id)
Updates the display of a model in the tree.
The core String View class for the NDEVR API.
Definition StringView.h:58
Provides behavior for flicking and other scroll behavior common to the NDEVR API.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.