#include <property_tree_model.h>
Signals | |
void | collapse (const QModelIndex &index) |
Emitted when a Property wants to collapse (hide its children). More... | |
void | configChanged () |
Emitted when a Property which should be saved changes. More... | |
void | expand (const QModelIndex &index) |
Emitted when a Property wants to expand (display its children). More... | |
void | propertyHiddenChanged (const Property *property) |
Emitted when a property within the model is hidden or shown. More... | |
Public Member Functions | |
void | beginInsert (Property *parent_property, int row_within_parent, int count=1) |
void | beginRemove (Property *parent_property, int row_within_parent, int count=1) |
void | collapseProperty (Property *property) |
Collapse (hide the children of) the given Property. More... | |
int | columnCount (const QModelIndex &=QModelIndex()) const override |
Return the number of columns under the given parent index, which is always 2 for this model. More... | |
QVariant | data (const QModelIndex &index, int role) const override |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int destination_row, int destination_column, const QModelIndex &destination_parent) override |
Override from QAbstractItemModel. Takes a (non-standard) mime-encoded version of an index list and drops it at the destination. More... | |
void | emitDataChanged (Property *property) |
void | emitPropertyHiddenChanged (const Property *property) |
Emit the propertyHiddenChanged() signal for the given Property. More... | |
void | endInsert () |
void | endRemove () |
void | expandProperty (Property *property) |
Expand (show the children of) the given Property. More... | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
Property * | getProp (const QModelIndex &index) const |
return the Property at the given index, or the root property if the index is invalid. More... | |
Property * | getRoot () const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | indexOf (Property *property) const |
QMimeData * | mimeData (const QModelIndexList &indexes) const override |
Override from QAbstractItemModel. Returns a (non-standard) mime-encoded version of the given indexes. More... | |
QStringList | mimeTypes () const override |
Returns a list with just "application/x-rviz-" plus drag_drop_class_. More... | |
QModelIndex | parent (const QModelIndex &index) const override |
QModelIndex | parentIndex (const Property *child) const |
Same as parent() but taking a Property pointer instead of an index. More... | |
void | printPersistentIndices () |
For debugging only. Uses printf() to print the property names of current persistent indices. More... | |
PropertyTreeModel (Property *root_property, QObject *parent=nullptr) | |
Constructor. More... | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
Return the number of rows under the given parent index. More... | |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
void | setDragDropClass (const QString &drag_drop_class) |
Qt::DropActions | supportedDropActions () const override |
~PropertyTreeModel () override | |
Destructor. Deletes the root property (and thus the entire property tree). More... | |
Private Attributes | |
QString | drag_drop_class_ |
Property * | root_property_ |
Definition at line 38 of file property_tree_model.h.
rviz::PropertyTreeModel::PropertyTreeModel | ( | Property * | root_property, |
QObject * | parent = nullptr |
||
) |
Constructor.
root_property | The root of the property tree. PropertyTreeModel takes ownership of root_property and deletes it in its destructor. |
parent | A QObject to set as the parent. |
Definition at line 41 of file property_tree_model.cpp.
|
override |
Destructor. Deletes the root property (and thus the entire property tree).
Definition at line 47 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::beginInsert | ( | Property * | parent_property, |
int | row_within_parent, | ||
int | count = 1 |
||
) |
Definition at line 301 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::beginRemove | ( | Property * | parent_property, |
int | row_within_parent, | ||
int | count = 1 |
||
) |
Definition at line 316 of file property_tree_model.cpp.
|
signal |
Emitted when a Property wants to collapse (hide its children).
void rviz::PropertyTreeModel::collapseProperty | ( | Property * | property | ) |
Collapse (hide the children of) the given Property.
Definition at line 336 of file property_tree_model.cpp.
|
inlineoverride |
Return the number of columns under the given parent index, which is always 2 for this model.
Definition at line 75 of file property_tree_model.h.
|
signal |
Emitted when a Property which should be saved changes.
|
override |
Definition at line 123 of file property_tree_model.cpp.
|
override |
Override from QAbstractItemModel. Takes a (non-standard) mime-encoded version of an index list and drops it at the destination.
The model indexes are encoded using pointer values (by mimeData()), which means they will only work within the application this is compiled into.
Definition at line 203 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::emitDataChanged | ( | Property * | property | ) |
Definition at line 290 of file property_tree_model.cpp.
|
inline |
Emit the propertyHiddenChanged() signal for the given Property.
Definition at line 134 of file property_tree_model.h.
void rviz::PropertyTreeModel::endInsert | ( | ) |
Definition at line 310 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::endRemove | ( | ) |
Definition at line 325 of file property_tree_model.cpp.
|
signal |
Emitted when a Property wants to expand (display its children).
void rviz::PropertyTreeModel::expandProperty | ( | Property * | property | ) |
Expand (show the children of) the given Property.
Definition at line 331 of file property_tree_model.cpp.
|
override |
Definition at line 65 of file property_tree_model.cpp.
Property * rviz::PropertyTreeModel::getProp | ( | const QModelIndex & | index | ) | const |
return the Property at the given index, or the root property if the index is invalid.
Definition at line 52 of file property_tree_model.cpp.
|
inline |
Definition at line 114 of file property_tree_model.h.
|
override |
Definition at line 134 of file property_tree_model.cpp.
|
override |
Definition at line 75 of file property_tree_model.cpp.
QModelIndex rviz::PropertyTreeModel::indexOf | ( | Property * | property | ) | const |
Definition at line 281 of file property_tree_model.cpp.
|
override |
Override from QAbstractItemModel. Returns a (non-standard) mime-encoded version of the given indexes.
Returns the model indexes encoded using pointer values, which means they will only work within the application this is compiled into.
Definition at line 166 of file property_tree_model.cpp.
|
override |
Returns a list with just "application/x-rviz-" plus drag_drop_class_.
Definition at line 274 of file property_tree_model.cpp.
|
override |
Definition at line 94 of file property_tree_model.cpp.
QModelIndex rviz::PropertyTreeModel::parentIndex | ( | const Property * | child | ) | const |
Same as parent() but taking a Property pointer instead of an index.
Definition at line 104 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::printPersistentIndices | ( | ) |
For debugging only. Uses printf() to print the property names of current persistent indices.
Definition at line 341 of file property_tree_model.cpp.
|
signal |
Emitted when a property within the model is hidden or shown.
|
override |
Return the number of rows under the given parent index.
Definition at line 118 of file property_tree_model.cpp.
|
override |
Definition at line 140 of file property_tree_model.cpp.
|
inline |
Definition at line 53 of file property_tree_model.h.
|
inlineoverride |
Definition at line 84 of file property_tree_model.h.
|
private |
Identifier to add to mimeTypes() entry to keep drag/drops from crossing types.
Definition at line 164 of file property_tree_model.h.
|
private |
Definition at line 163 of file property_tree_model.h.