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;
47 {
48 public:
49 virtual void setTreeWidgetsForSelection(const UUID& id, Buffer<QWidget*>& widgets, SceneTree* tree) = 0;
50 virtual UUID id() const = 0;
51 };
52 class SceneTreeModelDelegate : public QItemDelegate
53 {
54 Q_OBJECT
55 Q_PROPERTY(double selected_size READ selectedSize WRITE setSelectedSize)
56 public:
58 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
59 void drawDecoration(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, const QPixmap& pixmap) const override;
60 void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
61 void setEditorData(QWidget* editor, const QModelIndex& index) const override;
62 bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;
63 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
64 QWidget* popupButton();
65 UUID selected() const { return m_selected; }
66 static NDEVR_API void AddWidgetCallback(CustomTreeWidgets* delegate);
67 static NDEVR_API void RemoveWidgetCallback(const UUID& id);
68 protected:
70 public slots:
71 void indexSelected(const QModelIndex& index);
72 public:
73 fltp08 selectedSize() const { return m_grow_size; }
74 void setSelectedSize(fltp08 o);
75 int selectionBoxHeight() const;
76 protected:
80 QPropertyAnimation* m_grow_animation;
81 QPropertyAnimation* m_shrink_animation;
85 Button* m_properties = nullptr;
86 Button* m_zoom_to = nullptr;
89#if NDEVR_VIEWPORT
90 CameraLocationCombo* m_zoom_combo = nullptr;
91#endif
96 };
97}
#define NDEVR_API
Definition DLLInfo.h:67
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Button.h:60
Definition SceneTreeModelDelegate.h:47
virtual void setTreeWidgetsForSelection(const UUID &id, Buffer< QWidget * > &widgets, SceneTree *tree)=0
virtual UUID id() const =0
Definition DesignObjectVisibleButton.h:43
Definition Dictionary.h:48
Definition ProxyModelViewFilter.h:43
Definition SceneTree.h:50
Definition SceneTreeModelDelegate.h:53
QWidget * popupButton()
Definition SceneTreeModelDelegate.cpp:249
UUID selected() const
Definition SceneTreeModelDelegate.h:65
DesignObjectVisibleButton * m_visible
Definition SceneTreeModelDelegate.h:84
Button * m_properties
Definition SceneTreeModelDelegate.h:85
ProxyModelViewFilter * m_view
Definition SceneTreeModelDelegate.h:79
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition SceneTreeModelDelegate.cpp:198
Button * m_zoom_to
Definition SceneTreeModelDelegate.h:86
Button * m_context_menu
Definition SceneTreeModelDelegate.h:88
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition SceneTreeModelDelegate.cpp:41
UUID m_selected
Definition SceneTreeModelDelegate.h:94
static NDEVR_API void RemoveWidgetCallback(const UUID &id)
Definition SceneTreeModelDelegate.cpp:211
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Definition SceneTreeModelDelegate.cpp:173
fltp08 m_grow_size
Definition SceneTreeModelDelegate.h:95
void setSelectedSize(fltp08 o)
Definition SceneTreeModelDelegate.cpp:340
QPropertyAnimation * m_grow_animation
Definition SceneTreeModelDelegate.h:80
Button * m_save_button
Definition SceneTreeModelDelegate.h:87
SceneTreeModelDelegate(ProxyModelViewFilter *manager, SceneTree *parent)
Definition SceneTreeModelDelegate.cpp:20
QPropertyAnimation * m_shrink_animation
Definition SceneTreeModelDelegate.h:81
static Dictionary< UUID, CustomTreeWidgets * > s_custom_widget_callbacks
Definition SceneTreeModelDelegate.h:77
UUID m_current_selected
Definition SceneTreeModelDelegate.h:92
static NDEVR_API void AddWidgetCallback(CustomTreeWidgets *delegate)
Definition SceneTreeModelDelegate.cpp:207
double selected_size
Definition SceneTreeModelDelegate.h:55
QWidget * m_button_popup
Definition SceneTreeModelDelegate.h:83
Buffer< QWidget * > defaultWidgets()
Definition SceneTreeModelDelegate.cpp:272
void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QPixmap &pixmap) const override
Definition SceneTreeModelDelegate.cpp:169
SceneTree * m_parent
Definition SceneTreeModelDelegate.h:82
Buffer< QWidget * > m_last_widgets
Definition SceneTreeModelDelegate.h:78
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Definition SceneTreeModelDelegate.cpp:244
UUID m_old_selected
Definition SceneTreeModelDelegate.h:93
int selectionBoxHeight() const
Definition SceneTreeModelDelegate.cpp:353
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition SceneTreeModelDelegate.cpp:215
fltp08 selectedSize() const
Definition SceneTreeModelDelegate.h:73
void indexSelected(const QModelIndex &index)
Definition SceneTreeModelDelegate.cpp:129
Definition UUID.h:66
Definition ACIColor.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181