API Documentation
Loading...
Searching...
No Matches
QTModelManagerView.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: QTModelManagerView
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTModelManager.h>
34
35#include <NDEVR/Model.h>
36#include <QAbstractItemModel>
37#include <QIcon>
38namespace NDEVR
39{
40 class NDEVR_API QTModelManagerView final : public QAbstractItemModel
41 {
42 Q_OBJECT
43 protected:
45 {
49 QString name;
51 QString tooltip;
53 bool is_visible = true;
54 bool is_visible_recursive = true;
55 bool is_selected = false;
56 };
57 public:
58 QTModelManagerView(QTModelManager* manager, QObject *parent = nullptr);
59 QTModelManager& manager();
60 virtual ~QTModelManagerView() = default;
61 UUID getID(const QModelIndex& model_index) const;
62 Model model(const QModelIndex& model_index) const;
63 Model model(uint04 row, const QModelIndex& parent) const;
64 bool hasCached(const UUID& id) const;
65 QModelIndex getIndex(const Model& model) const;
66 QModelIndex getIndex(const UUID& id) const;
67 QIcon::Mode iconMode(const QModelIndex& index) const;
68 ModelCache createCache(const Model& model, bool recursive, bool parent_visible) const;
69 void updateModel3DVisible(const UUID& id, bool visible);
70
71 void recursiveCacheRemove(const UUID& id);
72 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
73 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
74 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
75 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
76 Qt::ItemFlags flags(const QModelIndex &index) const override;
77 //bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
78 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
79 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
80 QModelIndex parent(const QModelIndex& index) const override;
81
82
83 void setRootModels(const Buffer<UUID>& roots);
84 const Buffer<UUID>& rootModels() const { return m_root_models; }
85
86 void setIsRootFilter(const std::function<bool(const Model&)>& filter) { m_root_filter = filter; }
87 void addModel(UUID id);
88 QVariant data(const UUID& id, int role) const;
89 void refreshAll();
90 protected slots:
91 void clearAll();
92 void modelDeleted(Buffer<UUID> id);
93 void modelUpdated(UUID id);
94 void objectSelected(Buffer<UUID> id, bool selected);
95 void modelFocussed(UUID id, bool selected);
96 void modelAdded(Buffer<UUID> id);
97 void modelUpdatedSlot(const Buffer<UUID>& updated_ids);
98 void projectChanged(UUID id);
99 void topLevelChanged(Buffer<UUID> id);
100
101 protected:
102
109 std::function<bool(const Model&)> m_root_filter;
110 };
111}
#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:59
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:59
Definition Model.h:54
Definition QTModelManager.h:94
Definition QTModelManagerView.h:41
Buffer< UUID > m_index_ids
Definition QTModelManagerView.h:107
Dictionary< UUID, ModelCache > m_cached_indices
Definition QTModelManagerView.h:108
UUID m_project_id
Definition QTModelManagerView.h:106
Buffer< UUID > m_root_models
Definition QTModelManagerView.h:105
virtual ~QTModelManagerView()=default
std::function< bool(const Model &)> m_root_filter
Definition QTModelManagerView.h:109
QTModelManager * m_manager
Definition QTModelManagerView.h:104
UUID m_tree_capture_id
Definition QTModelManagerView.h:103
void setIsRootFilter(const std::function< bool(const Model &)> &filter)
Definition QTModelManagerView.h:86
const Buffer< UUID > & rootModels() const
Definition QTModelManagerView.h:84
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
The core String class for the software.
Definition String.h:47
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:115
Definition BaseValues.hpp:267
Definition QTModelManagerView.h:45
String icon
Definition QTModelManagerView.h:50
Buffer< UUID > children
Definition QTModelManagerView.h:47
QString tooltip
Definition QTModelManagerView.h:51
uint04 cache_index
Definition QTModelManagerView.h:46
QString name
Definition QTModelManagerView.h:49