Go to the documentation of this file.
39 #include <rviz/rviz_export.h>
43 class QStyleOptionViewItem;
47 class PropertyTreeModel;
132 Property(
const QString& name = QString(),
137 template <
typename Func,
typename R>
139 const QVariant& default_value,
140 const QString& description,
146 connect(receiver, std::forward<Func>(changed_slot));
150 template <
typename Func,
typename P>
152 const QVariant& default_value,
153 const QString& description,
158 connect(parent, std::forward<Func>(changed_slot));
161 using QObject::connect;
164 #ifdef RVIZ_DEPRECATE_QT4_SLOTS
165 [[deprecated(
"Switch to modern function/functor based slot specification")]]
167 QMetaObject::Connection
168 connect(
const QObject* receiver,
const char* slot, Qt::ConnectionType type = Qt::AutoConnection);
171 template <
typename Func,
typename R>
172 inline typename std::enable_if<QtPrivate::FunctionPointer<Func>::IsPointerToMemberFunction,
173 QMetaObject::Connection>::type
174 connect(
const R* receiver, Func&& slot, Qt::ConnectionType type = Qt::AutoConnection)
176 static_assert(std::is_convertible<R*,
typename QtPrivate::FunctionPointer<Func>::Object*>::value,
177 "receiver type doesn't match that expected by member function");
178 return QObject::connect(
this, &
Property::changed, receiver, std::forward<Func>(slot), type);
182 template <
typename Func>
183 inline typename std::enable_if<!QtPrivate::FunctionPointer<Func>::IsPointerToMemberFunction,
184 QMetaObject::Connection>::type
185 connect(
const QObject* context, Func&& slot, Qt::ConnectionType type = Qt::AutoConnection)
187 return QObject::connect(
this, &
Property::changed, context, std::forward<Func>(slot), type);
191 template <
typename Func>
192 inline typename std::enable_if<!QtPrivate::FunctionPointer<Func>::IsPointerToMemberFunction,
193 QMetaObject::Connection>::type
194 connect(Func&& slot, Qt::ConnectionType type = Qt::AutoConnection)
196 return QObject::connect(
this, &
Property::changed,
this, std::forward<Func>(slot), type);
211 virtual void removeChildren(
int start_index = 0,
int count = -1);
224 virtual bool setValue(
const QVariant& new_value);
228 virtual QVariant getValue()
const;
234 virtual void setName(
const QString& name);
237 virtual QString
getName()
const;
242 return getName().toStdString();
247 virtual void setDescription(
const QString& description);
250 virtual QString getDescription()
const;
281 virtual Property* subProp(
const QString& sub_name);
289 return children_.size();
306 virtual Property* childAtUnchecked(
int index)
const;
309 bool contains(
Property* possible_child)
const;
320 void setParent(
Property* new_parent);
334 virtual QVariant getViewData(
int column,
int role)
const;
341 virtual Qt::ItemFlags getViewFlags(
int column)
const;
354 virtual bool paint(QPainter* painter,
const QStyleOptionViewItem& option)
const
379 virtual QWidget* createEditor(QWidget* parent,
const QStyleOptionViewItem& option);
384 bool isAncestorOf(
Property* possible_child)
const;
400 virtual Property* takeChildAt(
int index);
407 virtual void addChild(
Property* child,
int index = -1);
410 void insertChildSorted(
Property* child);
427 int rowNumberInParent()
const;
430 virtual void moveChild(
int from_index,
int to_index);
434 virtual void load(
const Config& config);
438 virtual void save(
Config config)
const;
456 virtual bool getDisableChildren();
481 virtual void setHidden(
bool hidden);
499 is_read_only_ = read_only;
506 return is_read_only_;
513 virtual void collapse();
524 virtual void expand();
528 void aboutToChange();
533 void childListChanged(
Property* this_property);
540 void loadValue(
const Config& config);
574 void reindexChildren();
static Property * failprop_
The property returned by subProp() when the requested name is not found.
void show()
Show this Property in any PropertyTreeWidgets.
ROSCONSOLE_CONSOLE_IMPL_DECL std::string getName(void *handle)
std::string getNameStd() const
Return the name of this Property as a std::string.
int row_number_within_parent_
bool shouldBeSaved() const
Returns true if the property has data worth saving.
virtual int numChildren() const
Return the number of child objects (Property or otherwise).
virtual QIcon getIcon() const
virtual bool paint(QPainter *painter, const QStyleOptionViewItem &option) const
Hook to provide custom painting of the value data (right-hand column) in a subclass.
A single element of a property tree, with a name, value, description, and possibly children.
void setShouldBeSaved(bool save)
If save is false, neither the property nor its children will get saved. If true (the default),...
void hide()
Hide this Property in any PropertyTreeWidgets.
std::enable_if<!QtPrivate::FunctionPointer< Func >::IsPointerToMemberFunction, QMetaObject::Connection >::type connect(Func &&slot, Qt::ConnectionType type=Qt::AutoConnection)
Connect changed() signal to given slot functor, using this as context.
Property(const QString &name, const QVariant &default_value, const QString &description, P *parent, Func &&changed_slot)
std::enable_if<!QtPrivate::FunctionPointer< Func >::IsPointerToMemberFunction, QMetaObject::Connection >::type connect(const QObject *context, Func &&slot, Qt::ConnectionType type=Qt::AutoConnection)
Connect changed() signal to given slot functor, considering context.
virtual bool getHidden() const
Return the hidden/shown state. True means hidden, false means visible.
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.
virtual void setReadOnly(bool read_only)
Prevent or allow users to edit this property from a PropertyTreeWidget.
Property(const QString &name, const QVariant &default_value, const QString &description, Property *parent, Func &&changed_slot, const R *receiver)
QList< Property * > children_
std::enable_if< QtPrivate::FunctionPointer< Func >::IsPointerToMemberFunction, QMetaObject::Connection >::type connect(const R *receiver, Func &&slot, Qt::ConnectionType type=Qt::AutoConnection)
Connect changed() signal to given slot member function of receiver object.
virtual void setIcon(const QIcon &icon)
Set the icon to be displayed next to the property.
void changed()
Emitted by setValue() just after the value has changed.
QVariant value_
This is the central property value. If you set it directly in a subclass, do so with care because man...
PropertyTreeModel * getModel() const
Return the model managing this Property and its childrent.
Configuration data storage class.
virtual bool getReadOnly() const
Return the read-only-ness of this property.
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:02