API Documentation
Loading...
Searching...
No Matches
LayerWidget.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: LayerWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/QTModelManager.h>
35#include <NDEVR/QTDesignObject.h>
36#include <QAbstractItemModel>
37#include <QIcon>
38#include <QWidget>
39namespace Ui
40{
41 class LayerWidgetUI;
42}
43namespace NDEVR
44{
45 class LayerTable;
47 {
48 QIcon icon;
49 QString name;
50 QString description;
52 bool is_visible = false;
53 bool is_selected = false;
54 };
55 class LayerModel : public QAbstractItemModel
56 {
57 Q_OBJECT
58 public:
59 LayerModel(QTModelManager* manager);
60 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
61 QModelIndex parent(const QModelIndex& child) const override;
62 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
63 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
64 bool hasChildren(const QModelIndex& parent = QModelIndex()) const override;
65 QVector<int> cacheObject(UUID id);
66 const Buffer<UUID>& layers() const { return m_layers; }
67 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
68 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
69 protected slots:
70 void layerAddedSlot(Buffer<UUID> layer);
71 void layerUpdated(UUID layer);
72 void onClearAllSlot();
73 protected:
77 };
78 class NDEVR_API LayerWidget : public QWidget
79 {
80 Q_OBJECT
81 public:
82 LayerWidget(QTModelManager* manager, QWidget *parent = nullptr);
83 LayerWidget(QWidget* parent = nullptr);
84 void setModelManager(QTModelManager* manager);
85 void setCurrentLayer(UUID layer);
86 DynamicPointer<QTDesignObject> currentLayer() const;
87 void clearCurrentLayer();
88 protected slots:
89 void objectsSelectedSlot(Buffer<UUID> objects, bool selected);
90 void currentLayerDeletedSlot();
91 void currentLayerUpdatedSlot();
92 void layerSelectedSlot(UUID layer);
93 signals:
95 protected:
96 void updateWidget();
97 void updateLayerCombo();
98 void init();
99 bool event(QEvent* ev) override;
100
101 protected:
107 Ui::LayerWidgetUI* ui;
108 };
109}
#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 Dictionary.h:48
Definition Pointer.hpp:303
Definition LayerWidget.h:56
Buffer< UUID > m_layers
Definition LayerWidget.h:74
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition LayerWidget.cpp:68
void onClearAllSlot()
Definition LayerWidget.cpp:49
void layerUpdated(UUID layer)
Definition LayerWidget.cpp:39
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Definition LayerWidget.cpp:58
Dictionary< UUID, LayerCacheObject > m_layer_cache
Definition LayerWidget.h:76
const Buffer< UUID > & layers() const
Definition LayerWidget.h:66
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
Definition LayerWidget.cpp:78
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition LayerWidget.cpp:149
QModelIndex parent(const QModelIndex &child) const override
Definition LayerWidget.cpp:64
void layerAddedSlot(Buffer< UUID > layer)
Definition LayerWidget.cpp:27
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition LayerWidget.cpp:187
QTModelManager * m_manager
Definition LayerWidget.h:75
QVector< int > cacheObject(UUID id)
Definition LayerWidget.cpp:85
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition LayerWidget.cpp:74
LayerModel(QTModelManager *manager)
Definition LayerWidget.cpp:15
Definition LayerTable.h:6
Definition LayerWidget.h:79
Dictionary< UUID, UUID > m_layer_material_lookup
Definition LayerWidget.h:104
DynamicPointer< QTDesignObject > m_current_layer
Definition LayerWidget.h:103
LayerModel * m_layer_model
Definition LayerWidget.h:102
LayerTable * m_layer_table
Definition LayerWidget.h:106
QTModelManager * m_manager
Definition LayerWidget.h:105
Ui::LayerWidgetUI * ui
Definition LayerWidget.h:107
void currentLayerChangedSignal()
Definition QTModelManager.h:94
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition UUID.h:66
Definition ACIColor.h:37
Definition FontEditor.h:6
Definition BaseValues.hpp:272
Definition LayerWidget.h:47
bool is_visible
Definition LayerWidget.h:52
bool is_selected
Definition LayerWidget.h:53
RGBColor color
Definition LayerWidget.h:51
QIcon icon
Definition LayerWidget.h:48
QString description
Definition LayerWidget.h:50
QString name
Definition LayerWidget.h:49