Property specialized to provide max/min enforcement for integers. More...
#include <int_property.h>
Public Slots | |
void | setInt (int new_value) |
Set the value of this property to the given integer. | |
Public Member Functions | |
virtual QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option) |
Overridden to create a QSpinBox with the min and max set and with a signal/slot connection to setInt(), so the Property value updates every time the value changes, not just when "return" is pressed. | |
virtual int | getInt () const |
Return the internal property value as an integer. | |
int | getMax () |
int | getMin () |
IntProperty (const QString &name=QString(), int default_value=0, const QString &description=QString(), Property *parent=0, const char *changed_slot=0, QObject *receiver=0) | |
Constructor. | |
void | setMax (int max) |
void | setMin (int min) |
virtual bool | setValue (const QVariant &new_value) |
Set the new value for this property. Returns true if the new value is different from the old value, false if same. | |
Private Attributes | |
int | max_ |
int | min_ |
Property specialized to provide max/min enforcement for integers.
Definition at line 38 of file int_property.h.
rviz::IntProperty::IntProperty | ( | const QString & | name = QString() , |
int | default_value = 0 , |
||
const QString & | description = QString() , |
||
Property * | parent = 0 , |
||
const char * | changed_slot = 0 , |
||
QObject * | receiver = 0 |
||
) |
Constructor.
name | The name of this property. Appears in the left column of a PropertyTreeWidget. |
default_value | The initial value to store in the property. Appears in the right column of a PropertyTreeWidget. |
description | Text describing the property. Is shown in the "help" area of a PropertyTreeWithHelp widget. |
parent | The parent Property, or NULL if there is no parent at this time. |
changed_slot | This should be a Qt slot specification, generated by Qt's SLOT() macro. It should be a slot on the receiver object, or if receiver is not specified, it should be a slot on the parent. |
receiver | If receiver is non-NULL, the changed() signal is connected to the changed_slot on the receiver object. |
Definition at line 40 of file int_property.cpp.
QWidget * rviz::IntProperty::createEditor | ( | QWidget * | parent, |
const QStyleOptionViewItem & | option | ||
) | [virtual] |
Overridden to create a QSpinBox with the min and max set and with a signal/slot connection to setInt(), so the Property value updates every time the value changes, not just when "return" is pressed.
Reimplemented from rviz::Property.
Definition at line 69 of file int_property.cpp.
virtual int rviz::IntProperty::getInt | ( | ) | const [inline, virtual] |
Return the internal property value as an integer.
If a non-integer value was stored in this property, this will return 0.
Definition at line 73 of file int_property.h.
int rviz::IntProperty::getMax | ( | ) | [inline] |
Definition at line 78 of file int_property.h.
int rviz::IntProperty::getMin | ( | ) | [inline] |
Definition at line 76 of file int_property.h.
void rviz::IntProperty::setInt | ( | int | new_value | ) | [inline, slot] |
Set the value of this property to the given integer.
This just calls setValue(), which is where the min/max are enforced.
Definition at line 91 of file int_property.h.
void rviz::IntProperty::setMax | ( | int | max | ) |
Definition at line 63 of file int_property.cpp.
void rviz::IntProperty::setMin | ( | int | min | ) |
Definition at line 57 of file int_property.cpp.
bool rviz::IntProperty::setValue | ( | const QVariant & | new_value | ) | [virtual] |
Set the new value for this property. Returns true if the new value is different from the old value, false if same.
If the new value is different from the old value, this emits aboutToChange() before changing the value and changed() after.
Overridden from Property::setValue() to enforce minimum and maximum.
Reimplemented from rviz::Property.
Definition at line 52 of file int_property.cpp.
int rviz::IntProperty::max_ [private] |
Definition at line 95 of file int_property.h.
int rviz::IntProperty::min_ [private] |
Definition at line 94 of file int_property.h.