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;
46 /**--------------------------------------------------------------------------------------------------
47 \brief Stores cached information for the LayerModel
48 **/
50 {
51 QIcon icon;
52 QString name;
53 QString description;
55 bool is_visible = false;
56 bool is_selected = false;
57 };
58 /**--------------------------------------------------------------------------------------------------
59 \brief Used for showing Layers in a table using the QAbstractItemModel interface.
60 **/
61 class LayerModel : public QAbstractItemModel
62 {
63 Q_OBJECT
64 public:
66 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
67 QModelIndex parent(const QModelIndex& child) const override;
68 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
69 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
70 bool hasChildren(const QModelIndex& parent = QModelIndex()) const override;
71 QVector<int> cacheObject(UUID id);
72 const Buffer<UUID>& layers() const { return m_layers; }
73 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
74 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
75 protected slots:
77 void layerUpdated(UUID layer);
79 protected:
83 };
84 /**--------------------------------------------------------------------------------------------------
85 \brief A widget that allows the user to set or interface with the current layer.
86 **/
87 class NDEVR_API LayerWidget : public QWidget
88 {
89 Q_OBJECT
90 public:
91 LayerWidget(QTModelManager* manager, QWidget *parent = nullptr);
92 LayerWidget(QWidget* parent = nullptr);
94 void setCurrentLayer(UUID layer);
97 protected slots:
98 void objectsSelectedSlot(Buffer<UUID> objects, bool selected);
102 signals:
104 protected:
107 void init();
108 bool event(QEvent* ev) override;
109
110 protected:
116 Ui::LayerWidgetUI* ui;
117 };
118}
#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 hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
Used for showing Layers in a table using the QAbstractItemModel interface.
Definition LayerWidget.h:62
Buffer< UUID > m_layers
Definition LayerWidget.h:80
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void layerUpdated(UUID layer)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Dictionary< UUID, LayerCacheObject > m_layer_cache
Definition LayerWidget.h:82
const Buffer< UUID > & layers() const
Definition LayerWidget.h:72
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QModelIndex parent(const QModelIndex &child) const override
void layerAddedSlot(Buffer< UUID > layer)
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
QTModelManager * m_manager
Definition LayerWidget.h:81
QVector< int > cacheObject(UUID id)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
LayerModel(QTModelManager *manager)
A table showing a list of Layers.
Definition LayerTable.h:9
A widget that allows the user to set or interface with the current layer.
Definition LayerWidget.h:88
Dictionary< UUID, UUID > m_layer_material_lookup
Definition LayerWidget.h:113
void setModelManager(QTModelManager *manager)
DynamicPointer< QTDesignObject > currentLayer() const
LayerWidget(QWidget *parent=nullptr)
void currentLayerUpdatedSlot()
DynamicPointer< QTDesignObject > m_current_layer
Definition LayerWidget.h:112
void objectsSelectedSlot(Buffer< UUID > objects, bool selected)
LayerModel * m_layer_model
Definition LayerWidget.h:111
void currentLayerDeletedSlot()
LayerTable * m_layer_table
Definition LayerWidget.h:115
bool event(QEvent *ev) override
void setCurrentLayer(UUID layer)
void layerSelectedSlot(UUID layer)
QTModelManager * m_manager
Definition LayerWidget.h:114
Ui::LayerWidgetUI * ui
Definition LayerWidget.h:116
LayerWidget(QTModelManager *manager, QWidget *parent=nullptr)
void currentLayerChangedSignal()
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:54
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
Definition FontEditor.h:6
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Stores cached information for the LayerModel.
Definition LayerWidget.h:50
bool is_visible
Definition LayerWidget.h:55
bool is_selected
Definition LayerWidget.h:56
RGBColor color
Definition LayerWidget.h:54
QIcon icon
Definition LayerWidget.h:51
QString description
Definition LayerWidget.h:53
QString name
Definition LayerWidget.h:52