NDEVR
API Documentation
QTVertexManagerView.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: QTVertexManagerView
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/QTDesignObject.h>
35#include <NDEVR/Model.h>
36#include <NDEVR/DesignParameter.h>
37#include <NDEVR/Pointer.h>
38#include <QAbstractTableModel>
39#include <QItemDelegate>
40namespace NDEVR
41{
45 class VertexTableDelegate : public QItemDelegate
46 {
47 Q_OBJECT
48 public:
53 explicit VertexTableDelegate(QObject* parent = nullptr);
62 bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;
63 };
64
68 class NDEVR_API QTVertexManagerView final : public QAbstractTableModel
69 {
70 Q_OBJECT
71 public:
76 QTVertexManagerView(QObject *parent = nullptr);
82 QTVertexManagerView(const DynamicPointer<QTDesignObject>& root, QObject *parent = nullptr);
83 virtual ~QTVertexManagerView();
106 void setUseGlobalTransform(bool toggle) {
107 m_is_global = toggle;
108 }
109
114 bool isSpecialCallbackIndex(const QModelIndex& index) const;
121 void setParameters(const Buffer<DesignParameter>& params, bool enable_edit, bool enable_primitive_edit);
122 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
123 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
124 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
125 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
126 Qt::ItemFlags flags(const QModelIndex &index) const override;
132 void onClicked(const QModelIndex& index, QRect rect);
138 void onHovered(const QModelIndex& index, QRect rect);
143 void setEditable(bool editable);
144 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
149 Model model() const;
155 void displayLineworkEditor(uint04 vertex_index, PopupInfo info);
160 bool isEditable() const { return m_is_editable; };
161 protected:
164 signals:
166 protected slots:
171 protected:
172 UUID m_vertex_highlight_id = Constant<UUID>::Invalid;
176 bool m_is_editable = false;
177 bool m_is_global = false;
180 bool m_is_linework = false;
181 };
182}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
A core class that represents a node on model hierarchy.
Definition Model.h:292
void setTarget(const DynamicPointer< QTDesignObject > &root)
Sets the target design object whose vertices are displayed.
void cacheValues()
Rebuilds the cached vertex values from the target geometry.
void displayLineworkEditor(uint04 vertex_index, PopupInfo info)
Displays a linework editor dialog for a specific vertex.
bool m_has_primitive_edit_column
Whether a primitive edit button column is shown.
void onClicked(const QModelIndex &index, QRect rect)
Handles a click on a table cell, potentially opening an editor.
uint04 m_num_of_decimal
Number of decimal places for display.
void setParametersToGlobalLinework()
Configures the view to show global linework parameters.
QTVertexManagerView(const DynamicPointer< QTDesignObject > &root, QObject *parent=nullptr)
Constructs a vertex manager view targeting a specific design object.
void setParametersToLocalLocations()
Configures the view to show local location parameters.
bool isEditable() const
Checks whether the table is currently editable.
void deletedSlot()
Handles deletion of the target design object.
void setParameters(const Buffer< DesignParameter > &params, bool enable_edit, bool enable_primitive_edit)
Sets the design parameters displayed as columns in the table.
bool m_is_editable
Whether the table allows editing.
void contentsChanged()
Emitted when vertex data changes.
void setParametersToGlobalLocations()
Configures the view to show global location parameters.
QTVertexManagerView(QObject *parent=nullptr)
Constructs an empty vertex manager view.
bool m_is_global
Whether to use global transforms.
Buffer< DesignParameterAccumulator > m_properties
The design parameters used as table columns.
void updateSlot()
Handles updates to the target design object.
DynamicPointer< QTDesignObject > m_root
The target design object.
void setEditable(bool editable)
Enables or disables editing of vertex values.
void setUseGlobalTransform(bool toggle)
Sets whether to use global transforms when displaying vertex positions.
bool m_has_vertex_edit_column
Whether a vertex edit button column is shown.
UUID m_vertex_highlight_id
UUID of the highlighted vertex decoration.
void autoPopulateColumns()
Automatically populates column parameters based on the target geometry.
void onHovered(const QModelIndex &index, QRect rect)
Handles a hover event on a table cell.
bool isSpecialCallbackIndex(const QModelIndex &index) const
Checks whether the given index corresponds to a special callback column.
DynamicPointer< QTDesignObject > target() const
Retrieves the current target design object.
Model model() const
Retrieves the model associated with the current target.
bool m_is_linework
Whether the geometry is linework type.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Handles editor events such as clicks on vertex table cells.
VertexTableDelegate(QObject *parent=nullptr)
Constructs a VertexTableDelegate.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Class which is used to pass arguments and requests for creating a popup dialog or widget.
Definition PopupInfo.h:16