39 #include "rviz/rviz_export.h" 43 class QStyleOptionViewItem;
47 class PropertyTreeModel;
132 Property(
const QString& name = QString(),
136 const char* changed_slot =
nullptr,
137 QObject* receiver =
nullptr);
151 virtual void removeChildren(
int start_index = 0,
int count = -1);
164 virtual bool setValue(
const QVariant& new_value);
168 virtual QVariant getValue()
const;
174 virtual void setName(
const QString& name);
177 virtual QString
getName()
const;
182 return getName().toStdString();
187 virtual void setDescription(
const QString&
description);
190 virtual QString getDescription()
const;
221 virtual Property* subProp(
const QString& sub_name);
229 return children_.size();
246 virtual Property* childAtUnchecked(
int index)
const;
249 bool contains(
Property* possible_child)
const;
260 void setParent(
Property* new_parent);
274 virtual QVariant getViewData(
int column,
int role)
const;
281 virtual Qt::ItemFlags getViewFlags(
int column)
const;
294 virtual bool paint(QPainter* painter,
const QStyleOptionViewItem& option)
const 319 virtual QWidget* createEditor(QWidget* parent,
const QStyleOptionViewItem& option);
324 bool isAncestorOf(
Property* possible_child)
const;
340 virtual Property* takeChildAt(
int index);
347 virtual void addChild(
Property* child,
int index = -1);
350 void insertChildSorted(
Property* child);
367 int rowNumberInParent()
const;
370 virtual void moveChild(
int from_index,
int to_index);
378 virtual void save(
Config config)
const;
383 return !is_read_only_ && save_;
395 virtual bool getDisableChildren();
420 virtual void setHidden(
bool hidden);
438 is_read_only_ = read_only;
445 return is_read_only_;
452 virtual void collapse();
463 virtual void expand();
467 void aboutToChange();
472 void childListChanged(
Property* this_property);
479 void loadValue(
const Config& config);
513 void reindexChildren();
QList< Property * > children_
virtual QIcon getIcon() const
PropertyTreeModel * model_
Pointer to the PropertyTreeModel managing this property tree.
bool child_indexes_valid_
True if row_number_within_parent_ of all children is valid, false if not.
A single element of a property tree, with a name, value, description, and possibly children...
ROSCONSOLE_CONSOLE_IMPL_DECL std::string getName(void *handle)
PropertyTreeModel * getModel() const
Return the model managing this Property and its childrent.
QVariant value_
This is the central property value. If you set it directly in a subclass, do so with care because man...
int row_number_within_parent_
Configuration data storage class.
virtual void setIcon(const QIcon &icon)
Set the icon to be displayed next to the property.
static Property * failprop_
The property returned by subProp() when the requested name is not found.
void show()
Show this Property in any PropertyTreeWidgets.
virtual bool paint(QPainter *painter, const QStyleOptionViewItem &option) const
Hook to provide custom painting of the value data (right-hand column) in a subclass.
bool shouldBeSaved() const
Returns true if the property is not read-only AND has data worth saving.
void setShouldBeSaved(bool save)
If save is true and getReadOnly() is false, shouldBeSaved will return true; otherwise false...
std::string getNameStd() const
Return the name of this Property as a std::string.
virtual int numChildren() const
Return the number of child objects (Property or otherwise).
virtual bool getHidden() const
Return the hidden/shown state. True means hidden, false means visible.
void hide()
Hide this Property in any PropertyTreeWidgets.
virtual void setReadOnly(bool read_only)
Prevent or allow users to edit this property from a PropertyTreeWidget.
virtual bool getReadOnly()
Return the read-only-ness of this property.