API Documentation
Loading...
Searching...
No Matches
SceneTreeModelDelegate.h
Go to the documentation of this file.
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/UUID.h>
35#include <NDEVR/Dictionary.h>
36#include <QItemDelegate>
37 class QPropertyAnimation;
38namespace NDEVR
39{
40 class SceneTree;
41 class DesignObjectVisibleButton;
42 class ProxyModelViewFilter;
43 class Button;
44 class CameraLocationCombo;
45 class UUID;
46 /**--------------------------------------------------------------------------------------------------
47 \brief Allows for modification or addition of the widgets shown when an object is selected by
48 the user in the TreeView. Default widgets
49 **/
51 {
52 public:
53 virtual void setTreeWidgetsForSelection(const UUID& id, Buffer<QWidget*>& widgets, SceneTree* tree) = 0;
54 virtual UUID id() const = 0;
55 };
56 /**--------------------------------------------------------------------------------------------------
57 \brief Responsible for rendering an entry into a SceneTree widget.
58 **/
59 class SceneTreeModelDelegate : public QItemDelegate, public SoftwareServiceManager
60 {
61 Q_OBJECT
62 Q_PROPERTY(double selected_size READ selectedSize WRITE setSelectedSize)
63 public:
65 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
66 void drawDecoration(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, const QPixmap& pixmap) const override;
67 void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
68 void setEditorData(QWidget* editor, const QModelIndex& index) const override;
69 bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;
70 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
71 QWidget* popupButton();
72 UUID selected() const { return m_selected; }
74 static NDEVR_API void RemoveWidgetCallback(const UUID& id);
75 protected:
77 public slots:
78 void indexSelected(const QModelIndex& index);
79 public:
80 fltp08 selectedSize() const { return m_grow_size; }
82 int selectionBoxHeight() const;
83 protected:
87 QPropertyAnimation* m_grow_animation;
88 QPropertyAnimation* m_shrink_animation;
92 Button* m_properties = nullptr;
93 Button* m_zoom_to = nullptr;
96#if NDEVR_VIEWPORT
97 CameraLocationCombo* m_zoom_combo = nullptr;
98#endif
103 };
104}
#define NDEVR_API
Definition DLLInfo.h:50
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core widget that allows the user to click one of many button types.
Definition Button.h:66
Allows for modification or addition of the widgets shown when an object is selected by the user in th...
Definition SceneTreeModelDelegate.h:51
virtual void setTreeWidgetsForSelection(const UUID &id, Buffer< QWidget * > &widgets, SceneTree *tree)=0
virtual UUID id() const =0
A class for easily showing or hiding a Model in 3D space.
Definition DesignObjectVisibleButton.h:46
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Filters and sorts Models from a ModelManager for views such as in a table or in a tree view.
Definition ProxyModelViewFilter.h:46
Definition SceneTree.h:50
Responsible for rendering an entry into a SceneTree widget.
Definition SceneTreeModelDelegate.h:60
UUID selected() const
Definition SceneTreeModelDelegate.h:72
DesignObjectVisibleButton * m_visible
Definition SceneTreeModelDelegate.h:91
Button * m_properties
Definition SceneTreeModelDelegate.h:92
ProxyModelViewFilter * m_view
Definition SceneTreeModelDelegate.h:86
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Button * m_zoom_to
Definition SceneTreeModelDelegate.h:93
Button * m_context_menu
Definition SceneTreeModelDelegate.h:95
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
UUID m_selected
Definition SceneTreeModelDelegate.h:101
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
fltp08 m_grow_size
Definition SceneTreeModelDelegate.h:102
QPropertyAnimation * m_grow_animation
Definition SceneTreeModelDelegate.h:87
Button * m_save_button
Definition SceneTreeModelDelegate.h:94
SceneTreeModelDelegate(ProxyModelViewFilter *manager, SceneTree *parent)
QPropertyAnimation * m_shrink_animation
Definition SceneTreeModelDelegate.h:88
UUID m_current_selected
Definition SceneTreeModelDelegate.h:99
static void RemoveWidgetCallback(const UUID &id)
double selected_size
Definition SceneTreeModelDelegate.h:62
QWidget * m_button_popup
Definition SceneTreeModelDelegate.h:90
static void AddWidgetCallback(CustomTreeWidgets *delegate)
Buffer< QWidget * > defaultWidgets()
void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QPixmap &pixmap) const override
SceneTree * m_parent
Definition SceneTreeModelDelegate.h:89
Buffer< QWidget * > m_last_widgets
Definition SceneTreeModelDelegate.h:85
void setEditorData(QWidget *editor, const QModelIndex &index) const override
UUID m_old_selected
Definition SceneTreeModelDelegate.h:100
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
static Dictionary< UUID, CustomTreeWidgets * > s_custom_widget_callbacks
Definition SceneTreeModelDelegate.h:84
fltp08 selectedSize() const
Definition SceneTreeModelDelegate.h:80
void indexSelected(const QModelIndex &index)
Software Services provide an interface for adding to or changing the software behavior via functional...
Definition SoftwareService.h:9
Software Service Managers take a Software service to modify the behavior of the software.
Definition SoftwareService.h:15
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
Definition ACIColor.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149