29 #ifndef PROPERTY_MODEL_H 30 #define PROPERTY_MODEL_H 32 #include <QAbstractItemModel> 57 virtual QVariant
data(
const QModelIndex &
index,
int role )
const;
58 virtual QVariant
headerData(
int section, Qt::Orientation orientation,
59 int role = Qt::DisplayRole )
const;
61 virtual QModelIndex
index(
int row,
int column,
62 const QModelIndex &
parent = QModelIndex() )
const;
63 virtual QModelIndex
parent(
const QModelIndex &index )
const;
70 virtual int rowCount(
const QModelIndex &parent = QModelIndex() )
const;
74 virtual int columnCount(
const QModelIndex &parent = QModelIndex() )
const {
return 2; }
77 virtual Qt::ItemFlags
flags(
const QModelIndex &index )
const;
78 virtual bool setData(
const QModelIndex &index,
const QVariant &value,
79 int role = Qt::EditRole );
89 virtual QMimeData*
mimeData(
const QModelIndexList& indexes )
const;
100 int destination_row,
int destination_column,
101 const QModelIndex& destination_parent );
144 void expand(
const QModelIndex& index );
147 void collapse(
const QModelIndex& index );
156 #endif // PROPERTY_MODEL_H virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Return the number of columns under the given parent index, which is always 2 for this model...
void propertyHiddenChanged(const Property *property)
Emitted when a property within the model is hidden or shown.
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual QModelIndex parent(const QModelIndex &index) const
PropertyTreeModel(Property *root_property, QObject *parent=0)
Constructor.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
virtual ~PropertyTreeModel()
Destructor. Deletes the root property (and thus the entire property tree).
QString drag_drop_class_
Identifier to add to mimeTypes() entry to keep drag/drops from crossing types.
A single element of a property tree, with a name, value, description, and possibly children...
void printPersistentIndices()
For debugging only. Uses printf() to print the property names of current persistent indices...
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Return the number of rows under the given parent index.
void collapse(const QModelIndex &index)
Emitted when a Property wants to collapse (hide its children).
void expand(const QModelIndex &index)
Emitted when a Property wants to expand (display its children).
void beginRemove(Property *parent_property, int row_within_parent, int count=1)
QModelIndex parentIndex(const Property *child) const
Same as parent() but taking a Property pointer instead of an index.
virtual QStringList mimeTypes() const
Returns a list with just "application/x-rviz-" plus drag_drop_class_.
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Override from QAbstractItemModel. Returns a (non-standard) mime-encoded version of the given indexes...
void expandProperty(Property *property)
Expand (show the children of) the given Property.
QModelIndex indexOf(Property *property) const
virtual QVariant data(const QModelIndex &index, int role) const
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
void configChanged()
Emitted when a Property which should be saved changes.
virtual Qt::ItemFlags flags(const QModelIndex &index) const
void setDragDropClass(const QString &drag_drop_class)
void collapseProperty(Property *property)
Collapse (hide the children of) the given Property.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int destination_row, int destination_column, const QModelIndex &destination_parent)
Override from QAbstractItemModel. Takes a (non-standard) mime-encoded version of an index list and dr...
void emitDataChanged(Property *property)
void beginInsert(Property *parent_property, int row_within_parent, int count=1)
Property * getProp(const QModelIndex &index) const
return the Property at the given index, or the root property if the index is invalid.
void emitPropertyHiddenChanged(const Property *property)
Emit the propertyHiddenChanged() signal for the given Property.
Property * getRoot() const
virtual Qt::DropActions supportedDropActions() const
Property * root_property_