Public Slots | Signals | Public Member Functions | Private Attributes
rviz::EnumProperty Class Reference

Enum property. More...

#include <enum_property.h>

Inheritance diagram for rviz::EnumProperty:
Inheritance graph
[legend]

List of all members.

Public Slots

virtual void setString (const QString &str)
 Set the value of this property to the given string. Does not force the value to be one of the list of options.
void setStringStd (const std::string &str)
 Set the value of this property to the given std::string. Does not force the value to be one of the list of options.
void sortOptions ()
 Sort the option strings. Does not change string/int associations.

Signals

void requestOptions (EnumProperty *property_in_need_of_options)
 requestOptions() is emitted each time createEditor() is called.

Public Member Functions

virtual void addOption (const QString &option, int value=0)
void addOptionStd (const std::string &option, int value=0)
virtual void clearOptions ()
 Clear the list of options.
virtual QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option)
 Create an editor widget to edit the value of this property.
 EnumProperty (const QString &name=QString(), const QString &default_value=QString(), const QString &description=QString(), Property *parent=0, const char *changed_slot=0, QObject *receiver=0)
virtual int getOptionInt ()
 Return the int value of the currently-chosen option, or 0 if the current option string does not have an int value.

Private Attributes

QHash< QString, int > ints_
QStringList strings_

Detailed Description

Enum property.

An enum property works like a string property all the way through the system property system, except when you get a changed() signal you can call getOptionInt() to get the integer value of the current option. The integer returned will be that passed to addOption() for with the string that is currently selected.

Definition at line 47 of file enum_property.h.


Constructor & Destructor Documentation

rviz::EnumProperty::EnumProperty ( const QString &  name = QString(),
const QString &  default_value = QString(),
const QString &  description = QString(),
Property parent = 0,
const char *  changed_slot = 0,
QObject *  receiver = 0 
)

Definition at line 37 of file enum_property.cpp.


Member Function Documentation

void rviz::EnumProperty::addOption ( const QString &  option,
int  value = 0 
) [virtual]

Definition at line 53 of file enum_property.cpp.

void rviz::EnumProperty::addOptionStd ( const std::string &  option,
int  value = 0 
) [inline]

Definition at line 63 of file enum_property.h.

Clear the list of options.

Does not change the current value of the property.

Definition at line 47 of file enum_property.cpp.

QWidget * rviz::EnumProperty::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option 
) [virtual]

Create an editor widget to edit the value of this property.

Parameters:
parentThe QWidget to set as the parent of the returned QWidget.
optionA QStyleOptionViewItem with parameters of the editor widget, like the rectangle, alignments, etc.
Returns:
the newly-created editor widget. The default implementation creates a QSpinBox for integer values, a FloatEdit for float or double values, or a QLineEdit for anything else.

If this function returns NULL, a QStyledItemDelegate will make an editor widget.

The widget returned by createEditor() must have one Q_PROPERTY with USER set to true. The PropertyTreeDelegate finds it, sets it with the results of PropertyTreeModel::data() after creation, and after editing is finished it reads it and calls PropertyTreeModel::setData() with the contents.

Reimplemented from rviz::Property.

Definition at line 70 of file enum_property.cpp.

Return the int value of the currently-chosen option, or 0 if the current option string does not have an int value.

Definition at line 59 of file enum_property.cpp.

void rviz::EnumProperty::requestOptions ( EnumProperty property_in_need_of_options) [signal]

requestOptions() is emitted each time createEditor() is called.

A connection to this signal should never be made with a queued connection, because then the "emit" would return before the changes to the options in the EnumProperty were made.

A connected slot should make calls to clearOptions() and/or addOption() as needed. The option list in the EnumProperty will not be cleared before the signal is emitted.

void rviz::EnumProperty::setString ( const QString &  str) [virtual, slot]

Set the value of this property to the given string. Does not force the value to be one of the list of options.

Reimplemented from rviz::StringProperty.

Definition at line 85 of file enum_property.cpp.

void rviz::EnumProperty::setStringStd ( const std::string &  str) [inline, slot]

Set the value of this property to the given std::string. Does not force the value to be one of the list of options.

Definition at line 79 of file enum_property.h.

void rviz::EnumProperty::sortOptions ( ) [inline, slot]

Sort the option strings. Does not change string/int associations.

Definition at line 82 of file enum_property.h.


Member Data Documentation

QHash<QString, int> rviz::EnumProperty::ints_ [private]

Definition at line 99 of file enum_property.h.

QStringList rviz::EnumProperty::strings_ [private]

Definition at line 98 of file enum_property.h.


The documentation for this class was generated from the following files:


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Thu Aug 27 2015 15:02:28