18 #ifndef _GAZEBO_GUI_CONFIGWIDGET_HH_
19 #define _GAZEBO_GUI_CONFIGWIDGET_HH_
26 #include <ignition/math/Color.hh>
27 #include <ignition/math/Pose3.hh>
28 #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);
209 public: google::protobuf::Message *Msg();
215 public:
static std::string HumanReadableKey(
const std::string &_key);
223 public: std::string UnitFromKey(
const std::string &_key,
224 const std::string &_jointType =
"")
const;
231 public:
void RangeFromKey(
const std::string &_key,
232 double &_min,
double &_max)
const;
237 public:
void SetWidgetVisible(
const std::string &_name,
bool _visible);
242 public:
bool WidgetVisible(
const std::string &_name)
const;
247 public:
void SetWidgetReadOnly(
const std::string &_name,
bool _readOnly);
252 public:
bool WidgetReadOnly(
const std::string &_name)
const;
256 public:
void UpdateFromMsg(
const google::protobuf::Message *_msg);
262 public:
bool SetIntWidgetValue(
const std::string &_name,
int _value);
268 public:
bool SetUIntWidgetValue(
const std::string &_name,
unsigned int
275 public:
bool SetDoubleWidgetValue(
const std::string &_name,
282 public:
bool SetBoolWidgetValue(
const std::string &_name,
bool _value);
287 public:
bool SetStringWidgetValue(
const std::string &_name,
288 const std::string &_value);
294 public:
bool SetVector3dWidgetValue(
const std::string &_name,
295 const ignition::math::Vector3d &_value);
302 public:
bool SetColorWidgetValue(
const std::string &_name,
309 public:
bool SetColorWidgetValue(
const std::string &_name,
310 const ignition::math::Color &_value);
316 public:
bool SetPoseWidgetValue(
const std::string &_name,
317 const ignition::math::Pose3d &_value);
324 public:
bool SetGeometryWidgetValue(
const std::string &_name,
325 const std::string &_value,
326 const ignition::math::Vector3d &_dimensions,
327 const std::string &_uri =
"");
333 public:
bool SetDensityWidgetValue(
const std::string &_name,
334 const double _value);
340 public:
bool SetEnumWidgetValue(
const std::string &_name,
341 const std::string &_value);
347 public:
bool AddItemEnumWidget(
const std::string &_name,
348 const std::string &_itemText);
354 public:
bool RemoveItemEnumWidget(
const std::string &_name,
355 const std::string &_itemText);
360 public:
bool ClearEnumWidget(
const std::string &_name);
365 public:
int IntWidgetValue(
const std::string &_name)
const;
370 public:
unsigned int UIntWidgetValue(
const std::string &_name)
const;
375 public:
double DoubleWidgetValue(
const std::string &_name)
const;
380 public:
bool BoolWidgetValue(
const std::string &_name)
const;
385 public: std::string StringWidgetValue(
const std::string &_name)
const;
390 public: ignition::math::Vector3d Vector3dWidgetValue(
391 const std::string &_name)
const;
396 public: ignition::math::Color ColorWidgetValue(
397 const std::string &_name)
const;
402 public: ignition::math::Pose3d PoseWidgetValue(
403 const std::string &_name)
const;
410 public: std::string GeometryWidgetValue(
const std::string &_name,
411 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
416 public:
double DensityWidgetValue(
const std::string &_name)
const;
421 public: std::string EnumWidgetValue(
const std::string &_name)
const;
429 public:
GroupWidget *CreateGroupWidget(
const std::string &_name,
437 const int _level = 0);
444 const int _level = 0);
451 const int _level = 0);
459 const int _level = 0,
const std::string &_type =
"line");
466 const int _level = 0);
473 const int _level = 0);
480 const int _level = 0);
487 const int _level = 0);
494 const int _level = 0);
502 const std::vector<std::string> &_values,
const int _level = 0);
509 const int _level = 0);
518 public:
bool AddConfigChildWidget(
const std::string &_name,
525 public:
void InsertLayout(QLayout *_layout,
int _pos);
532 const std::string &_name)
const;
536 public:
unsigned int ConfigChildWidgetCount()
const;
545 public:
static QString StyleSheet(
const std::string &_type,
546 const int _level = 0);
550 public:
static const std::vector<QString>
bgColors;
573 private: QWidget *Parse(google::protobuf::Message *_msg,
574 bool _update =
false,
const std::string &_name =
"",
575 const int _level = 0);
580 private: ignition::math::Vector3d ParseVector3d(
581 const google::protobuf::Message *_msg)
const;
586 private:
void UpdateMsg(google::protobuf::Message *_msg,
587 const std::string &_name =
"");
593 private:
void UpdateVector3dMsg(google::protobuf::Message *_msg,
594 const ignition::math::Vector3d &_value);
601 const unsigned int _value);
615 const double _value);
622 const std::string &_value);
636 const ignition::math::Vector3d &_value);
643 const ignition::math::Color &_value);
650 const ignition::math::Pose3d &_value);
659 const std::string &_value,
660 const ignition::math::Vector3d &_dimensions,
661 const std::string &_uri =
"");
668 const std::string &_value);
675 const double _value);
705 private: ignition::math::Vector3d Vector3dWidgetValue(
711 private: ignition::math::Color ColorWidgetValue(
717 private: ignition::math::Pose3d PoseWidgetValue(
726 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
736 private slots:
void OnItemSelection(QTreeWidgetItem *_item,
740 private slots:
void OnUIntValueChanged();
743 private slots:
void OnIntValueChanged();
746 private slots:
void OnDoubleValueChanged();
749 private slots:
void OnBoolValueChanged();
752 private slots:
void OnStringValueChanged();
755 private slots:
void OnVector3dValueChanged();
759 private slots:
void OnVector3dPresetChanged(
const int _index);
762 private slots:
void OnColorValueChanged();
767 private slots:
void OnColorValueChanged(
const QColor _value);
770 private slots:
void OnPoseValueChanged();
773 private slots:
void OnGeometryValueChanged();
777 private slots:
void OnGeometryValueChanged(
const int _value);
781 private slots:
void OnEnumValueChanged(
const QString &_value);
785 private slots:
void OnCustomColorDialog();
790 Q_SIGNALS:
void UIntValueChanged(
const QString &_name,
791 const unsigned int _value);
796 Q_SIGNALS:
void IntValueChanged(
const QString &_name,
const int _value);
801 Q_SIGNALS:
void DoubleValueChanged(
const QString &_name,
802 const double _value);
807 Q_SIGNALS:
void BoolValueChanged(
const QString &_name,
815 Q_SIGNALS:
void StringValueChanged(
const QString &_name,
816 const std::string &_value);
821 Q_SIGNALS:
void Vector3dValueChanged(
const QString &_name,
822 const ignition::math::Vector3d &_value);
827 Q_SIGNALS:
void ColorValueChanged(
const QString &_name,
828 const ignition::math::Color &_value);
833 Q_SIGNALS:
void PoseValueChanged(
const QString &_name,
834 const ignition::math::Pose3d &_pose);
841 Q_SIGNALS:
void GeometryValueChanged(
const std::string &_name,
842 const std::string &_value,
843 const ignition::math::Vector3d &_dimensions,
844 const std::string &_uri);
849 Q_SIGNALS:
void EnumValueChanged(
const QString &_name,
850 const QString &_value);
854 Q_SIGNALS:
void DensityValueChanged(
const double &_value);
858 Q_SIGNALS:
void MassValueChanged(
const double &_value);
862 private slots:
void OnDensityValueChanged(
const double _value);
866 private slots:
void OnMassValueChanged(
const double _value);
869 private slots:
void OnGeometryChanged();
872 Q_SIGNALS:
void GeometryChanged();
878 private:
bool eventFilter(QObject *_obj, QEvent *_event);
882 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
static const std::vector< QString > widgetColors
List of colors used for widget areas according to their level.
Definition: ConfigWidget.hh:553
static const QString greenColor
Green color used for "green" or "y" fields.
Definition: ConfigWidget.hh:559
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:562
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:550
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:556
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
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
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