34#include <NDEVR/DesignObject.h>
35#include <NDEVR/DesignParameter.h>
36#include <QSortFilterProxyModel>
37#include <QAbstractTableModel>
45 class QTResourceListener;
84 , type(
std::move(type))
91 bool is_clicked =
false;
93 bool is_currently_editable =
false;
130 [[nodiscard]]
int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
131 [[nodiscard]]
int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
133 [[nodiscard]] QVariant
data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
134 [[nodiscard]] QVariant
userData(
const QModelIndex& index,
int role)
const;
137 [[nodiscard]]
bool setData(
const QModelIndex& index,
const QVariant& value,
int role)
override;
138 [[nodiscard]] QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
151 [[nodiscard]] Qt::ItemFlags
flags(
const QModelIndex& index)
const override;
201 void sort(Qt::SortOrder order = Qt::DescendingOrder);
202 void sort(
int column, Qt::SortOrder order = Qt::DescendingOrder)
override;
206 void onSelected(
const QModelIndex& index,
const QRect& rect);
224 virtual bool filterAcceptsRow(
int sourceRow,
const QModelIndex& sourceParent)
const override;
225 virtual bool lessThan(
const QModelIndex& left,
const QModelIndex& right)
const override;
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
Definition DesignObject.h:67
DesignProperty
Values stored in the property database.
Definition DesignObject.h:93
A definition of data that is logically stored in the Model heirarchy. Data could be a property of a M...
Definition DesignParameter.h:46
Provides the ability to pull data from a DesignObjectLookup for display in tables within the NDEVR AP...
Definition DesignTableModel.h:195
ModelTableColumnSpec currentSearchParameter() const
DesignTableModel * m_design_model
Definition DesignTableModel.h:234
void sortBy(const Buffer< ModelTableColumnSpec > &specs, Qt::SortOrder order=Qt::DescendingOrder)
void setSearchString(const String &search_string)
void onSelected(const QModelIndex &index, const QRect &rect)
DesignSortFilterProxyModel(DesignTableModel *model, QObject *parent=nullptr)
Model getModel(const QModelIndex &index)
bool isSpecialCallbackIndex(const QModelIndex &index) const
void searchByParameterChangedSignal()
DesignTableModel * model()
UUID getUUID(const QModelIndex &index)
void setSortCallback(const std::function< bool(const Model &a, const Model &b)> &callback)
std::function< void(Model, PopupInfo)> m_selected_callback
Definition DesignTableModel.h:230
String m_search_string
Definition DesignTableModel.h:229
TranslatedString searchByTitle() const
ModelTableColumnSpec m_search_parameter
Definition DesignTableModel.h:232
ModelTableColumnSpec m_current_search_parameter
Definition DesignTableModel.h:233
void sort(Qt::SortOrder order=Qt::DescendingOrder)
void sortBy(DesignObject::DesignProperty property, Qt::SortOrder order=Qt::DescendingOrder)
void setSearchParameter(const ModelTableColumnSpec &search_parameter)
bool isMaterialIndex(const QModelIndex &index) const
ModelTableColumnSpec columnSpec(const QModelIndex &index)
Buffer< ModelTableColumnSpec > m_sort_by
Definition DesignTableModel.h:235
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
void setIsEditable(bool is_editable)
void sortBy(ModelTableColumnSpec spec, Qt::SortOrder order=Qt::DescendingOrder)
void setColumnEditable(uint04 column, bool is_editable)
const std::function< void(Model, PopupInfo)> & selectedCallback() const
Definition DesignTableModel.h:220
std::function< bool(const Model &a, const Model &b)> m_sort_function
Definition DesignTableModel.h:231
QTModelManager * modelManager() const
Definition DesignTableModel.h:217
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
void setSelectedCallback(const std::function< void(Model, PopupInfo)> &callback)
Definition DesignTableModel.h:218
bool modelIsShown(const DynamicPointer< QTDesignObject > &a) const
void sort(int column, Qt::SortOrder order=Qt::DescendingOrder) override
Provides the ability to pull data from a DesignObjectLookup for display in tables within the NDEVR AP...
Definition DesignTableModel.h:124
uint04 addGrandparentNameColumn(const TranslatedString &custom_column_name=TranslatedString())
virtual ~DesignTableModel()
void onSelected(QModelIndex index, const QRect &rect)
Buffer< UUID > m_models
Definition DesignTableModel.h:180
uint04 addParentPathColumn(const TranslatedString &custom_column_name=TranslatedString())
void setList(const Buffer< UUID > &models)
DesignObject getObject(QModelIndex index) const
void setModelManager(QTModelManager *manager)
uint04 addColumn(const ModelTableColumnSpec &column)
bool canAddObject(const Model &object) const
void setAddedFilter(const std::function< bool(const Model &)> &callback)
Definition DesignTableModel.h:140
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
bool isSpecialCallbackIndex(const QModelIndex &index) const
void updateColumn(uint04 index)
QVariant userData(const QModelIndex &index, int role) const
uint04 addColumn(const DesignParameter ¶meter, bool is_editable)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
virtual void modelUpdated(const Buffer< UUID > &ids)
virtual void objectAdded(const Buffer< UUID > &ids)
Qt::ItemFlags flags(const QModelIndex &index) const override
std::function< bool(const Model &)> m_added_filter
Definition DesignTableModel.h:181
Buffer< TranslatedString > m_custom_column_titles
Definition DesignTableModel.h:183
uint04 addColumn(const TranslatedString &name, const String &icon, const std::function< void(UUID)> &callback)
DynamicPointer< QTDesignObject > getDesignObject(QModelIndex index, int row) const
Model getModel(QModelIndex index) const
bool isObjectAllowed(const UUID &object) const
DynamicPointer< QTDesignObject > getDesignObject(QModelIndex index) const
virtual void objectDeleted(const Buffer< UUID > &ids)
bool setData(const QModelIndex &index, const QVariant &value, int role) override
bool isMaterialIndex(const QModelIndex &index) const
UUID getUUID(QModelIndex index) const
DesignTableModel(QObject *parent=nullptr)
bool isObjectAllowed(const Model &object) const
Buffer< BitFlag > m_callback_clicked
Definition DesignTableModel.h:184
bool m_is_editable
Definition DesignTableModel.h:188
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
uint04 addParentDataColumn(const DesignParameter ¶m, bool is_editable, const TranslatedString &custom_column_name=TranslatedString())
void objectDeletedSlot(const Buffer< UUID > &ids)
void setIsEditable(bool is_editable)
void setColumnEditable(uint04 column, bool is_editable)
UUID getUUID(QModelIndex index, int row) const
DesignObject getObject(QModelIndex index, int row) const
uint04 addColumn(DesignObject::DesignProperty property, bool is_editable)
QTModelManager * m_manager
Definition DesignTableModel.h:179
void objectAddedSlot(const Buffer< UUID > &ids)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QTModelManager * modelManager() const
Definition DesignTableModel.h:152
Buffer< ModelTableColumnSpec > m_columns
Definition DesignTableModel.h:182
void modelUpdatedSlot(const Buffer< UUID > &ids)
const ModelTableColumnSpec & getColumnSpec(uint04 column) const
uint04 addMaterialDataColumn(const TranslatedString &custom_column_name=TranslatedString())
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
The core String class for the NDEVR API.
Definition String.h:69
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
constexpr int model_table_is_selected_index
Definition DesignTableModel.h:47
constexpr int model_table_is_clicked_index
Definition DesignTableModel.h:46
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
Definition DesignTableModel.h:75
String type
Definition DesignTableModel.h:77
RelativePathObject(RelativePath path, String type)
Definition DesignTableModel.h:82
RelativePathObject(RelativePath path)
Definition DesignTableModel.h:79
RelativePath path
Definition DesignTableModel.h:76
Provides the ability to pull specific data from a DesignObjectLookup for display in a column of a tab...
Definition DesignTableModel.h:53
DesignObject getTarget(const DesignObject &a, bool try_to_create) const
uint04 min_decimal_places
Definition DesignTableModel.h:95
String stringDisplayData(const DesignObject &obj) const
ModelTableColumnSpec(const std::function< void(UUID)> &callback)
TranslatedString headerTitle() const
ModelTableColumnSpec(const DesignParameter ¶meter, Buffer< RelativePathObject > relative_mode)
ModelTableType
Definition DesignTableModel.h:55
bool setData(const DesignObject &obj, const QVariant &value, int role)
TranslatedString custom_column_name
Definition DesignTableModel.h:88
bool isSortEqual(const DesignObject &a, const DesignObject &b) const
ModelTableColumnSpec(const TranslatedString &text, const String &icon, const std::function< void(UUID)> &callback)
QVariant data(const DesignObject &obj, int role=Qt::DisplayRole) const
std::function< void(UUID)> callback
Definition DesignTableModel.h:96
bool isCheckEditable() const
QVariant parameterData(const DesignObject &obj, int role) const
bool is_editable
Definition DesignTableModel.h:92
String custom_icon
Definition DesignTableModel.h:90
TranslatedString custom_text
Definition DesignTableModel.h:89
DesignParameter design_parameter
Definition DesignTableModel.h:97
uint04 max_decimal_places
Definition DesignTableModel.h:94
ModelTableColumnSpec(ModelTableType type)
ModelTableType column_type
Definition DesignTableModel.h:87
bool isTextEditable() const
ModelTableColumnSpec(const DesignParameter ¶meter)
Buffer< RelativePathObject > relative_path
Definition DesignTableModel.h:98
bool isSortLessThan(const DesignObject &a, const DesignObject &b) const
RelativePath
Definition DesignTableModel.h:61
@ e_child_index
Definition DesignTableModel.h:64