NDEVR
API Documentation
ModelSelectionTree.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: ModelSelectionTree
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Buffer.h>
35#include <NDEVR/UUID.h>
36#include <QTreeView>
37class QTreeWidgetItem;
38namespace NDEVR
39{
40 class String;
42 class Log;
43 class QTModelManager;
45 class Button;
46 class TranslatedString;
51 class NDEVR_API ModelSelectionTree : public QTreeView
52 {
53 Q_OBJECT
54 public:
59 explicit ModelSelectionTree(QWidget* parent = nullptr);
65 explicit ModelSelectionTree(QTModelManager* manager, QWidget* parent = nullptr);
72 explicit ModelSelectionTree(ProxyModelViewFilter* manager, bool owns_filter, QWidget* parent = nullptr);
87 void setFilter(ProxyModelViewFilter* filter, bool owns_filter);
98 bool event(QEvent* e) override;
114 void setSelectedModelRoots(const Buffer<UUID>& roots, bool only_visible_children);
124 void setHeader(const TranslatedString& header_title, const StringView& header_icon);
138 void resizeEvent(QResizeEvent* size) override;
139 protected:
145 signals:
150 protected:
155 protected slots:
160 void selectionChanged(const QItemSelection& selected, const QItemSelection&) override;
166 void updateFocus(UUID id, bool focussed);
177 void updateSelection(UUID id, bool selected);
182 void contextMenu(const QPoint &pos);
187 void onExpandedSlot(const QModelIndex& index);
192 void onCollapsedSlot(const QModelIndex& index);
197 void clickedSlot(const QModelIndex &index);
198 private:
199 ProxyModelViewFilter* m_design_model = nullptr;
200 Button* m_context_menu_button = nullptr;
201 bool m_auto_expanding = false;
202 bool m_owns_design_model = false;
203 };
204}
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
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:50
bool event(QEvent *e) override
Processes general Qt events, including tooltip and drag events.
void initialize()
Initializes common state such as context menu policy and column settings.
void resizeEvent(QResizeEvent *size) override
Handles resize events to adjust column widths.
void setSelectedModelRoots(const Buffer< UUID > &roots, bool only_visible_children)
Sets the check state for the given root models and optionally their visible children.
void selectAllVisible()
Selects all visible items in the tree view.
void updateFocus(UUID id, bool focussed)
Slot called to update the focus highlight for a model.
void updateModel(UUID id)
Slot called when a model is updated, refreshing its tree display.
void onCollapsedSlot(const QModelIndex &index)
Slot called when a tree item is collapsed.
void setModelManager(QTModelManager *manager)
Sets the model manager and creates a default proxy filter.
ProxyModelViewFilter * filter() const
Returns the proxy filter model used by this tree view.
QTModelManager * manager() const
Returns the model manager associated with this tree view.
void clickedSlot(const QModelIndex &index)
Slot called when a tree item is clicked.
ModelSelectionTree(QTModelManager *manager, QWidget *parent=nullptr)
Constructs the tree view with the given model manager.
void onExpandedSlot(const QModelIndex &index)
Slot called when a tree item is expanded.
void selectionChanged(const QItemSelection &selected, const QItemSelection &) override
Slot called when the tree selection changes, updating the scene selection.
Buffer< UUID > getModelRoots() const
Returns the UUIDs of all root-level models in the tree.
void checkStateChanged()
Emitted when the check state of any item changes.
virtual ~ModelSelectionTree()
Destroys the tree view and optionally deletes the owned filter.
void updateSelection(UUID id, bool selected)
Slot called when a model's selection state changes.
void setupFilter(ProxyModelViewFilter *filter)
Configures the proxy filter and connects its signals to the tree view.
void expandSelected()
Expands the tree to show all currently selected items.
ModelSelectionTree(ProxyModelViewFilter *manager, bool owns_filter, QWidget *parent=nullptr)
Constructs the tree view with a custom proxy filter.
Buffer< UUID > getSelectedModelRoots() const
Returns the UUIDs of all checked root-level models.
void setHeader(const TranslatedString &header_title, const StringView &header_icon)
Sets the header title and icon for the tree view.
void contextMenu(const QPoint &pos)
Slot called to show the context menu at the given position.
ModelSelectionTree(QWidget *parent=nullptr)
Constructs the tree view with no initial model manager.
void setFilter(ProxyModelViewFilter *filter, bool owns_filter)
Sets a custom proxy filter for the tree view.
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...
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
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.