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 GeometryChanged(
const QString _text);
113 private slots:
void OnSelectFile();
124 Q_SIGNALS:
void EnumValueChanged(
const QString &_value);
128 private slots:
void EnumChanged(
const QString &_value);
142 private slots:
void Toggle(
bool _checked);
159 public:
void Load(
const google::protobuf::Message *_msg);
168 public: google::protobuf::Message *Msg();
175 public: std::string GetHumanReadableKey(
const std::string &_key)
182 public: std::string HumanReadableKey(
const std::string &_key)
const;
192 public: std::string GetUnitFromKey(
const std::string &_key,
201 public: std::string UnitFromKey(
const std::string &_key,
202 const std::string &_jointType =
"")
const;
212 public:
void GetRangeFromKey(
const std::string &_key,
220 public:
void RangeFromKey(
const std::string &_key,
221 double &_min,
double &_max)
const;
226 public:
void SetWidgetVisible(
const std::string &_name,
bool _visible);
232 public:
bool GetWidgetVisible(
const std::string &_name)
const
238 public:
bool WidgetVisible(
const std::string &_name)
const;
243 public:
void SetWidgetReadOnly(
const std::string &_name,
bool _readOnly);
249 public:
bool GetWidgetReadOnly(
const std::string &_name)
const
255 public:
bool WidgetReadOnly(
const std::string &_name)
const;
259 public:
void UpdateFromMsg(
const google::protobuf::Message *_msg);
265 public:
bool SetIntWidgetValue(
const std::string &_name,
int _value);
271 public:
bool SetUIntWidgetValue(
const std::string &_name,
unsigned int
278 public:
bool SetDoubleWidgetValue(
const std::string &_name,
285 public:
bool SetBoolWidgetValue(
const std::string &_name,
bool _value);
290 public:
bool SetStringWidgetValue(
const std::string &_name,
291 const std::string &_value);
299 public:
bool SetVector3WidgetValue(
const std::string &_name,
306 public:
bool SetVector3dWidgetValue(
const std::string &_name,
307 const ignition::math::Vector3d &_value);
313 public:
bool SetColorWidgetValue(
const std::string &_name,
322 public:
bool SetPoseWidgetValue(
const std::string &_name,
329 public:
bool SetPoseWidgetValue(
const std::string &_name,
330 const ignition::math::Pose3d &_value);
341 public:
bool SetGeometryWidgetValue(
const std::string &_name,
350 public:
bool SetGeometryWidgetValue(
const std::string &_name,
351 const std::string &_value,
352 const ignition::math::Vector3d &_dimensions,
353 const std::string &_uri =
"");
359 public:
bool SetEnumWidgetValue(
const std::string &_name,
360 const std::string &_value);
366 public:
bool AddItemEnumWidget(
const std::string &_name,
367 const std::string &_itemText);
373 public:
bool RemoveItemEnumWidget(
const std::string &_name,
374 const std::string &_itemText);
379 public:
bool ClearEnumWidget(
const std::string &_name);
385 public:
int GetIntWidgetValue(
const std::string &_name)
const
391 public:
int IntWidgetValue(
const std::string &_name)
const;
397 public:
unsigned int GetUIntWidgetValue(
const std::string &_name)
const
403 public:
unsigned int UIntWidgetValue(
const std::string &_name)
const;
409 public:
double GetDoubleWidgetValue(
const std::string &_name)
const
415 public:
double DoubleWidgetValue(
const std::string &_name)
const;
421 public:
bool GetBoolWidgetValue(
const std::string &_name)
const
427 public:
bool BoolWidgetValue(
const std::string &_name)
const;
433 public: std::string GetStringWidgetValue(
const std::string &_name)
const
439 public: std::string StringWidgetValue(
const std::string &_name)
const;
445 public:
math::Vector3 GetVector3WidgetValue(
const std::string &_name)
451 public: ignition::math::Vector3d Vector3dWidgetValue(
452 const std::string &_name)
const;
458 public:
common::Color GetColorWidgetValue(
const std::string &_name)
const
464 public:
common::Color ColorWidgetValue(
const std::string &_name)
const;
470 public:
math::Pose GetPoseWidgetValue(
const std::string &_name)
const
476 public: ignition::math::Pose3d PoseWidgetValue(
477 const std::string &_name)
const;
486 public: std::string GetGeometryWidgetValue(
const std::string &_name,
495 public: std::string GeometryWidgetValue(
const std::string &_name,
496 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
502 public: std::string GetEnumWidgetValue(
const std::string &_name)
const
508 public: std::string EnumWidgetValue(
const std::string &_name)
const;
516 public:
GroupWidget *CreateGroupWidget(
const std::string &_name,
524 const int _level = 0);
531 const int _level = 0);
538 const int _level = 0);
546 const int _level = 0,
const std::string &_type =
"line");
553 const int _level = 0);
560 const int _level = 0);
567 const int _level = 0);
574 const int _level = 0);
581 const int _level = 0);
589 const std::vector<std::string> &_values,
const int _level = 0);
598 public:
bool AddConfigChildWidget(
const std::string &_name,
605 public:
void InsertLayout(QLayout *_layout,
int _pos);
612 const std::string &_name)
const;
616 public:
unsigned int ConfigChildWidgetCount()
const;
625 public:
static QString StyleSheet(
const std::string &_type,
626 const int _level = 0);
630 public:
static const std::vector<QString>
bgColors;
653 private: QWidget *Parse(google::protobuf::Message *_msg,
654 bool _update =
false,
const std::string &_name =
"",
655 const int _level = 0);
660 private: ignition::math::Vector3d ParseVector3d(
661 const google::protobuf::Message *_msg)
const;
666 private:
void UpdateMsg(google::protobuf::Message *_msg,
667 const std::string &_name =
"");
672 private:
void UpdateVector3dMsg(google::protobuf::Message *_msg,
673 const ignition::math::Vector3d &_value);
680 const unsigned int _value);
694 const double _value);
701 const std::string &_value);
715 const ignition::math::Vector3d &_value);
729 const ignition::math::Pose3d &_value);
738 const std::string &_value,
739 const ignition::math::Vector3d &_dimensions,
740 const std::string &_uri =
"");
747 const std::string &_value);
777 private: ignition::math::Vector3d Vector3dWidgetValue(
788 private: ignition::math::Pose3d PoseWidgetValue(
797 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
807 private slots:
void OnItemSelection(QTreeWidgetItem *_item,
811 private slots:
void OnUIntValueChanged();
814 private slots:
void OnIntValueChanged();
817 private slots:
void OnDoubleValueChanged();
820 private slots:
void OnBoolValueChanged();
823 private slots:
void OnStringValueChanged();
826 private slots:
void OnVector3dValueChanged();
830 private slots:
void OnVector3dPresetChanged(
const int _index);
833 private slots:
void OnColorValueChanged();
836 private slots:
void OnPoseValueChanged();
839 private slots:
void OnGeometryValueChanged();
843 private slots:
void OnGeometryValueChanged(
const int _value);
847 private slots:
void OnEnumValueChanged(
const QString &_value);
852 Q_SIGNALS:
void UIntValueChanged(
const QString &_name,
853 const unsigned int _value);
858 Q_SIGNALS:
void IntValueChanged(
const QString &_name,
const int _value);
863 Q_SIGNALS:
void DoubleValueChanged(
const QString &_name,
864 const double _value);
869 Q_SIGNALS:
void BoolValueChanged(
const QString &_name,
877 Q_SIGNALS:
void StringValueChanged(
const QString &_name,
878 const std::string &_value);
883 Q_SIGNALS:
void Vector3dValueChanged(
const QString &_name,
884 const ignition::math::Vector3d &_value);
889 Q_SIGNALS:
void ColorValueChanged(
const QString &_name,
895 Q_SIGNALS:
void PoseValueChanged(
const QString &_name,
896 const ignition::math::Pose3d &_pose);
903 Q_SIGNALS:
void GeometryValueChanged(
const std::string &_name,
904 const std::string &_value,
905 const ignition::math::Vector3d &_dimensions,
906 const std::string &_uri);
911 Q_SIGNALS:
void EnumValueChanged(
const QString &_name,
912 const QString &_value);
918 private:
bool eventFilter(QObject *_obj, QEvent *_event);
922 private: std::unique_ptr<ConfigWidgetPrivate> dataPtr;
QWidget * geomLengthLabel
A label for the length widget.
Definition: ConfigWidget.hh:94
QWidget * geomFilenameLabel
A label for the mesh filename widget.
Definition: ConfigWidget.hh:103
static const QString blueColor
Blue color used for "blue" or "z" fields.
Definition: ConfigWidget.hh:642
GroupWidget * groupWidget
Pointer to group widget.
Definition: ConfigWidget.hh:77
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
QWidget * childWidget
Child widget that can be collapsed or expanded.
Definition: ConfigWidget.hh:138
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
#define GZ_GUI_VISIBLE
Definition: system.hh:284
static const std::vector< QString > widgetColors
List of colors used for widget areas according to their level.
Definition: ConfigWidget.hh:633
ConfigChildWidget()
Constructor;.
Definition: ConfigWidget.hh:61
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
QWidget * geomFilenameButton
A button for selecting the mesh filename.
Definition: ConfigWidget.hh:106
QWidget * geomLengthSpinBox
A spin box for configuring the length of the geometry.
Definition: ConfigWidget.hh:91
QWidget * geomFilenameLineEdit
A line edit for editing the mesh filename.
Definition: ConfigWidget.hh:100
std::vector< QWidget * > widgets
List of widgets holding values, such as Spins and LineEdits.
Definition: ConfigWidget.hh:70
static const QString greenColor
Green color used for "green" or "y" fields.
Definition: ConfigWidget.hh:639
static const QString redColor
Red color used for "red" or "x" fields.
Definition: ConfigWidget.hh:636
static const std::vector< QString > bgColors
List of colors used for the background of widgets according to their level.
Definition: ConfigWidget.hh:630
std::map< QWidget *, QLabel * > mapWidgetToUnit
Map a widget to the label holding its unit value.
Definition: ConfigWidget.hh:73
#define NULL
Definition: CommonTypes.hh:31
Defines a color.
Definition: Color.hh:36
QWidget * geomLengthUnitLabel
A label for the unit of the length widget.
Definition: ConfigWidget.hh:97
QStackedWidget * geomDimensionWidget
A stacked widget containing widgets for configuring geometry dimensions.
Definition: ConfigWidget.hh:88
std::string key
Widget's key value.
Definition: ConfigWidget.hh:64
std::string scopedName
Widget's scoped name within parent config widget.
Definition: ConfigWidget.hh:67