#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, bool emit_config_changed=true) |
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 42 of file property_tree_model.cpp.
|
override |
Destructor. Deletes the root property (and thus the entire property tree).
Definition at line 48 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::beginInsert | ( | Property * | parent_property, |
int | row_within_parent, | ||
int | count = 1 |
||
) |
Definition at line 305 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::beginRemove | ( | Property * | parent_property, |
int | row_within_parent, | ||
int | count = 1 |
||
) |
Definition at line 320 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 340 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 120 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 207 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::emitDataChanged | ( | Property * | property, |
bool | emit_config_changed = true |
||
) |
emit dataChanged() and configChanged() signals (the latter can be suppressed)
Definition at line 294 of file property_tree_model.cpp.
|
inline |
Emit the propertyHiddenChanged() signal for the given Property.
Definition at line 135 of file property_tree_model.h.
void rviz::PropertyTreeModel::endInsert | ( | ) |
Definition at line 314 of file property_tree_model.cpp.
void rviz::PropertyTreeModel::endRemove | ( | ) |
Definition at line 329 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 335 of file property_tree_model.cpp.
|
override |
Definition at line 66 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 53 of file property_tree_model.cpp.
|
inline |
Definition at line 114 of file property_tree_model.h.
|
override |
Definition at line 131 of file property_tree_model.cpp.
|
override |
Definition at line 76 of file property_tree_model.cpp.
QModelIndex rviz::PropertyTreeModel::indexOf | ( | Property * | property | ) | const |
Definition at line 285 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 170 of file property_tree_model.cpp.
|
override |
Returns a list with just "application/x-rviz-" plus drag_drop_class_.
Definition at line 278 of file property_tree_model.cpp.
|
override |
Definition at line 95 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 105 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 345 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 115 of file property_tree_model.cpp.
|
override |
Definition at line 137 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 165 of file property_tree_model.h.
|
private |
Definition at line 164 of file property_tree_model.h.