18 #ifndef _GAZEBO_GUI_CONFIGWIDGET_HH_
19 #define _GAZEBO_GUI_CONFIGWIDGET_HH_
26 #include <ignition/math/Pose3.hh>
27 #include <ignition/math/Vector3.hh>
39 class FieldDescriptor;
47 class ConfigWidgetPrivate;
64 public: std::string
key;
110 private slots:
void OnGeometryTypeChanged(
const QString &_text);
114 private slots:
void OnGeometrySizeChanged(
const double _value);
117 private slots:
void OnSelectFile();
120 Q_SIGNALS:
void GeometryChanged();
134 public:
void SetDensity(
const double _density);
138 public:
double Density()
const;
142 private slots:
void OnComboBoxChanged(
const QString &_text);
146 private slots:
void OnSpinBoxChanged(
const QString &_text);
150 Q_SIGNALS:
void DensityValueChanged(
const double &_value);
159 private:
double density;
170 Q_SIGNALS:
void EnumValueChanged(
const QString &_value);
174 private slots:
void EnumChanged(
const QString &_value);
188 private slots:
void Toggle(
bool _checked);
205 public:
void Load(
const google::protobuf::Message *_msg);
214 public: google::protobuf::Message *Msg();
221 public: std::string GetHumanReadableKey(
const std::string &_key)
228 public: std::string HumanReadableKey(
const std::string &_key)
const;
238 public: std::string GetUnitFromKey(
const std::string &_key,
247 public: std::string UnitFromKey(
const std::string &_key,
248 const std::string &_jointType =
"")
const;
258 public:
void GetRangeFromKey(
const std::string &_key,
266 public:
void RangeFromKey(
const std::string &_key,
267 double &_min,
double &_max)
const;
272 public:
void SetWidgetVisible(
const std::string &_name,
bool _visible);
278 public:
bool GetWidgetVisible(
const std::string &_name)
const
284 public:
bool WidgetVisible(
const std::string &_name)
const;
289 public:
void SetWidgetReadOnly(
const std::string &_name,
bool _readOnly);
295 public:
bool GetWidgetReadOnly(
const std::string &_name)
const
301 public:
bool WidgetReadOnly(
const std::string &_name)
const;
305 public:
void UpdateFromMsg(
const google::protobuf::Message *_msg);
311 public:
bool SetIntWidgetValue(
const std::string &_name,
int _value);
317 public:
bool SetUIntWidgetValue(
const std::string &_name,
unsigned int
324 public:
bool SetDoubleWidgetValue(
const std::string &_name,
331 public:
bool SetBoolWidgetValue(
const std::string &_name,
bool _value);
336 public:
bool SetStringWidgetValue(
const std::string &_name,
337 const std::string &_value);
345 public:
bool SetVector3WidgetValue(
const std::string &_name,
352 public:
bool SetVector3dWidgetValue(
const std::string &_name,
353 const ignition::math::Vector3d &_value);
359 public:
bool SetColorWidgetValue(
const std::string &_name,
368 public:
bool SetPoseWidgetValue(
const std::string &_name,
375 public:
bool SetPoseWidgetValue(
const std::string &_name,
376 const ignition::math::Pose3d &_value);
387 public:
bool SetGeometryWidgetValue(
const std::string &_name,
396 public:
bool SetGeometryWidgetValue(
const std::string &_name,
397 const std::string &_value,
398 const ignition::math::Vector3d &_dimensions,
399 const std::string &_uri =
"");
405 public:
bool SetDensityWidgetValue(
const std::string &_name,
406 const double _value);
412 public:
bool SetEnumWidgetValue(
const std::string &_name,
413 const std::string &_value);
419 public:
bool AddItemEnumWidget(
const std::string &_name,
420 const std::string &_itemText);
426 public:
bool RemoveItemEnumWidget(
const std::string &_name,
427 const std::string &_itemText);
432 public:
bool ClearEnumWidget(
const std::string &_name);
438 public:
int GetIntWidgetValue(
const std::string &_name)
const
444 public:
int IntWidgetValue(
const std::string &_name)
const;
450 public:
unsigned int GetUIntWidgetValue(
const std::string &_name)
const
456 public:
unsigned int UIntWidgetValue(
const std::string &_name)
const;
462 public:
double GetDoubleWidgetValue(
const std::string &_name)
const
468 public:
double DoubleWidgetValue(
const std::string &_name)
const;
474 public:
bool GetBoolWidgetValue(
const std::string &_name)
const
480 public:
bool BoolWidgetValue(
const std::string &_name)
const;
486 public: std::string GetStringWidgetValue(
const std::string &_name)
const
492 public: std::string StringWidgetValue(
const std::string &_name)
const;
498 public:
math::Vector3 GetVector3WidgetValue(
const std::string &_name)
504 public: ignition::math::Vector3d Vector3dWidgetValue(
505 const std::string &_name)
const;
511 public:
common::Color GetColorWidgetValue(
const std::string &_name)
const
517 public:
common::Color ColorWidgetValue(
const std::string &_name)
const;
523 public:
math::Pose GetPoseWidgetValue(
const std::string &_name)
const
529 public: ignition::math::Pose3d PoseWidgetValue(
530 const std::string &_name)
const;
539 public: std::string GetGeometryWidgetValue(
const std::string &_name,
548 public: std::string GeometryWidgetValue(
const std::string &_name,
549 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
554 public:
double DensityWidgetValue(
const std::string &_name)
const;
560 public: std::string GetEnumWidgetValue(
const std::string &_name)
const
566 public: std::string EnumWidgetValue(
const std::string &_name)
const;
574 public:
GroupWidget *CreateGroupWidget(
const std::string &_name,
582 const int _level = 0);
589 const int _level = 0);
596 const int _level = 0);
604 const int _level = 0,
const std::string &_type =
"line");
611 const int _level = 0);
618 const int _level = 0);
625 const int _level = 0);
632 const int _level = 0);
639 const int _level = 0);
647 const std::vector<std::string> &_values,
const int _level = 0);
654 const int _level = 0);
663 public:
bool AddConfigChildWidget(
const std::string &_name,
670 public:
void InsertLayout(QLayout *_layout,
int _pos);
677 const std::string &_name)
const;
681 public:
unsigned int ConfigChildWidgetCount()
const;
690 public:
static QString StyleSheet(
const std::string &_type,
691 const int _level = 0);
695 public:
static const std::vector<QString>
bgColors;
718 private: QWidget *Parse(google::protobuf::Message *_msg,
719 bool _update =
false,
const std::string &_name =
"",
720 const int _level = 0);
725 private: ignition::math::Vector3d ParseVector3d(
726 const google::protobuf::Message *_msg)
const;
731 private:
void UpdateMsg(google::protobuf::Message *_msg,
732 const std::string &_name =
"");
737 private:
void UpdateVector3dMsg(google::protobuf::Message *_msg,
738 const ignition::math::Vector3d &_value);
745 const unsigned int _value);
759 const double _value);
766 const std::string &_value);
780 const ignition::math::Vector3d &_value);
794 const ignition::math::Pose3d &_value);
803 const std::string &_value,
804 const ignition::math::Vector3d &_dimensions,
805 const std::string &_uri =
"");
812 const std::string &_value);
819 const double _value);
849 private: ignition::math::Vector3d Vector3dWidgetValue(
860 private: ignition::math::Pose3d PoseWidgetValue(
869 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
879 private slots:
void OnItemSelection(QTreeWidgetItem *_item,
883 private slots:
void OnUIntValueChanged();
886 private slots:
void OnIntValueChanged();
889 private slots:
void OnDoubleValueChanged();
892 private slots:
void OnBoolValueChanged();
895 private slots:
void OnStringValueChanged();
898 private slots:
void OnVector3dValueChanged();
902 private slots:
void OnVector3dPresetChanged(
const int _index);
905 private slots:
void OnColorValueChanged();
908 private slots:
void OnPoseValueChanged();
911 private slots:
void OnGeometryValueChanged();
915 private slots:
void OnGeometryValueChanged(
const int _value);
919 private slots:
void OnEnumValueChanged(
const QString &_value);
924 Q_SIGNALS:
void UIntValueChanged(
const QString &_name,
925 const unsigned int _value);
930 Q_SIGNALS:
void IntValueChanged(
const QString &_name,
const int _value);
935 Q_SIGNALS:
void DoubleValueChanged(
const QString &_name,
936 const double _value);
941 Q_SIGNALS:
void BoolValueChanged(
const QString &_name,
949 Q_SIGNALS:
void StringValueChanged(
const QString &_name,
950 const std::string &_value);
955 Q_SIGNALS:
void Vector3dValueChanged(
const QString &_name,
956 const ignition::math::Vector3d &_value);
961 Q_SIGNALS:
void ColorValueChanged(
const QString &_name,
967 Q_SIGNALS:
void PoseValueChanged(
const QString &_name,
968 const ignition::math::Pose3d &_pose);
975 Q_SIGNALS:
void GeometryValueChanged(
const std::string &_name,
976 const std::string &_value,
977 const ignition::math::Vector3d &_dimensions,
978 const std::string &_uri);
983 Q_SIGNALS:
void EnumValueChanged(
const QString &_name,
984 const QString &_value);
988 Q_SIGNALS:
void DensityValueChanged(
const double &_value);
992 Q_SIGNALS:
void MassValueChanged(
const double &_value);
996 private slots:
void OnDensityValueChanged(
const double _value);
1000 private slots:
void OnMassValueChanged(
const double _value);
1003 private slots:
void OnGeometryChanged();
1006 Q_SIGNALS:
void GeometryChanged();
1012 private:
bool eventFilter(QObject *_obj, QEvent *_event);
1016 private: std::unique_ptr<ConfigWidgetPrivate> dataPtr;
QComboBox * comboBox
A combo box for selecting a material density.
Definition: ConfigWidget.hh:153
GroupWidget * groupWidget
Pointer to group widget.
Definition: ConfigWidget.hh:77
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
static const std::vector< QString > widgetColors
List of colors used for widget areas according to their level.
Definition: ConfigWidget.hh:698
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
static const QString greenColor
Green color used for "green" or "y" fields.
Definition: ConfigWidget.hh:704
QWidget * geomFilenameLineEdit
A line edit for editing the mesh filename.
Definition: ConfigWidget.hh:100
static const QString blueColor
Blue color used for "blue" or "z" fields.
Definition: ConfigWidget.hh:707
QWidget * geomLengthSpinBox
A spin box for configuring the length of the geometry.
Definition: ConfigWidget.hh:91
QWidget * geomFilenameButton
A button for selecting the mesh filename.
Definition: ConfigWidget.hh:106
static const std::vector< QString > bgColors
List of colors used for the background of widgets according to their level.
Definition: ConfigWidget.hh:695
QWidget * childWidget
Child widget that can be collapsed or expanded.
Definition: ConfigWidget.hh:184
static const QString redColor
Red color used for "red" or "x" fields.
Definition: ConfigWidget.hh:701
std::string scopedName
Widget's scoped name within parent config widget.
Definition: ConfigWidget.hh:67
QDoubleSpinBox * spinBox
A spin box for entering a density value.
Definition: ConfigWidget.hh:156
#define NULL
Definition: CommonTypes.hh:31
QStackedWidget * geomDimensionWidget
A stacked widget containing widgets for configuring geometry dimensions.
Definition: ConfigWidget.hh:88
Defines a color.
Definition: Color.hh:36
QWidget * geomLengthUnitLabel
A label for the unit of the length widget.
Definition: ConfigWidget.hh:97
std::map< QWidget *, QLabel * > mapWidgetToUnit
Map a widget to the label holding its unit value.
Definition: ConfigWidget.hh:73
QWidget * geomLengthLabel
A label for the length widget.
Definition: ConfigWidget.hh:94
ConfigChildWidget()
Constructor;.
Definition: ConfigWidget.hh:61
QWidget * geomFilenameLabel
A label for the mesh filename widget.
Definition: ConfigWidget.hh:103
std::string key
Widget's key value.
Definition: ConfigWidget.hh:64
std::vector< QWidget * > widgets
List of widgets holding values, such as Spins and LineEdits.
Definition: ConfigWidget.hh:70