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);
301 public:
bool SetColorWidgetValue(
const std::string &_name,
302 const ignition::math::Color &_value);
308 public:
bool SetPoseWidgetValue(
const std::string &_name,
309 const ignition::math::Pose3d &_value);
316 public:
bool SetGeometryWidgetValue(
const std::string &_name,
317 const std::string &_value,
318 const ignition::math::Vector3d &_dimensions,
319 const std::string &_uri =
"");
325 public:
bool SetDensityWidgetValue(
const std::string &_name,
326 const double _value);
332 public:
bool SetEnumWidgetValue(
const std::string &_name,
333 const std::string &_value);
339 public:
bool AddItemEnumWidget(
const std::string &_name,
340 const std::string &_itemText);
346 public:
bool RemoveItemEnumWidget(
const std::string &_name,
347 const std::string &_itemText);
352 public:
bool ClearEnumWidget(
const std::string &_name);
357 public:
int IntWidgetValue(
const std::string &_name)
const;
362 public:
unsigned int UIntWidgetValue(
const std::string &_name)
const;
367 public:
double DoubleWidgetValue(
const std::string &_name)
const;
372 public:
bool BoolWidgetValue(
const std::string &_name)
const;
377 public: std::string StringWidgetValue(
const std::string &_name)
const;
382 public: ignition::math::Vector3d Vector3dWidgetValue(
383 const std::string &_name)
const;
388 public: ignition::math::Color ColorWidgetValue(
389 const std::string &_name)
const;
394 public: ignition::math::Pose3d PoseWidgetValue(
395 const std::string &_name)
const;
402 public: std::string GeometryWidgetValue(
const std::string &_name,
403 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
408 public:
double DensityWidgetValue(
const std::string &_name)
const;
413 public: std::string EnumWidgetValue(
const std::string &_name)
const;
421 public:
GroupWidget *CreateGroupWidget(
const std::string &_name,
429 const int _level = 0);
436 const int _level = 0);
443 const int _level = 0);
451 const int _level = 0,
const std::string &_type =
"line");
458 const int _level = 0);
465 const int _level = 0);
472 const int _level = 0);
479 const int _level = 0);
486 const int _level = 0);
494 const std::vector<std::string> &_values,
const int _level = 0);
501 const int _level = 0);
510 public:
bool AddConfigChildWidget(
const std::string &_name,
517 public:
void InsertLayout(QLayout *_layout,
int _pos);
524 const std::string &_name)
const;
528 public:
unsigned int ConfigChildWidgetCount()
const;
537 public:
static QString StyleSheet(
const std::string &_type,
538 const int _level = 0);
542 public:
static const std::vector<QString>
bgColors;
565 private: QWidget *Parse(google::protobuf::Message *_msg,
566 bool _update =
false,
const std::string &_name =
"",
567 const int _level = 0);
572 private: ignition::math::Vector3d ParseVector3d(
573 const google::protobuf::Message *_msg)
const;
578 private:
void UpdateMsg(google::protobuf::Message *_msg,
579 const std::string &_name =
"");
585 private:
void UpdateVector3dMsg(google::protobuf::Message *_msg,
586 const ignition::math::Vector3d &_value);
593 const unsigned int _value);
607 const double _value);
614 const std::string &_value);
628 const ignition::math::Vector3d &_value);
635 const ignition::math::Color &_value);
642 const ignition::math::Pose3d &_value);
651 const std::string &_value,
652 const ignition::math::Vector3d &_dimensions,
653 const std::string &_uri =
"");
660 const std::string &_value);
667 const double _value);
697 private: ignition::math::Vector3d Vector3dWidgetValue(
703 private: ignition::math::Color ColorWidgetValue(
709 private: ignition::math::Pose3d PoseWidgetValue(
718 ignition::math::Vector3d &_dimensions, std::string &_uri)
const;
728 private slots:
void OnItemSelection(QTreeWidgetItem *_item,
732 private slots:
void OnUIntValueChanged();
735 private slots:
void OnIntValueChanged();
738 private slots:
void OnDoubleValueChanged();
741 private slots:
void OnBoolValueChanged();
744 private slots:
void OnStringValueChanged();
747 private slots:
void OnVector3dValueChanged();
751 private slots:
void OnVector3dPresetChanged(
const int _index);
754 private slots:
void OnColorValueChanged();
759 private slots:
void OnColorValueChanged(
const QColor _value);
762 private slots:
void OnPoseValueChanged();
765 private slots:
void OnGeometryValueChanged();
769 private slots:
void OnGeometryValueChanged(
const int _value);
773 private slots:
void OnEnumValueChanged(
const QString &_value);
777 private slots:
void OnCustomColorDialog();
782 Q_SIGNALS:
void UIntValueChanged(
const QString &_name,
783 const unsigned int _value);
788 Q_SIGNALS:
void IntValueChanged(
const QString &_name,
const int _value);
793 Q_SIGNALS:
void DoubleValueChanged(
const QString &_name,
794 const double _value);
799 Q_SIGNALS:
void BoolValueChanged(
const QString &_name,
807 Q_SIGNALS:
void StringValueChanged(
const QString &_name,
808 const std::string &_value);
813 Q_SIGNALS:
void Vector3dValueChanged(
const QString &_name,
814 const ignition::math::Vector3d &_value);
819 Q_SIGNALS:
void ColorValueChanged(
const QString &_name,
820 const ignition::math::Color &_value);
825 Q_SIGNALS:
void PoseValueChanged(
const QString &_name,
826 const ignition::math::Pose3d &_pose);
833 Q_SIGNALS:
void GeometryValueChanged(
const std::string &_name,
834 const std::string &_value,
835 const ignition::math::Vector3d &_dimensions,
836 const std::string &_uri);
841 Q_SIGNALS:
void EnumValueChanged(
const QString &_name,
842 const QString &_value);
846 Q_SIGNALS:
void DensityValueChanged(
const double &_value);
850 Q_SIGNALS:
void MassValueChanged(
const double &_value);
854 private slots:
void OnDensityValueChanged(
const double _value);
858 private slots:
void OnMassValueChanged(
const double _value);
861 private slots:
void OnGeometryChanged();
864 Q_SIGNALS:
void GeometryChanged();
870 private:
bool eventFilter(QObject *_obj, QEvent *_event);
874 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
Forward declarations for the common classes.
Definition: Animation.hh:26
static const std::vector< QString > widgetColors
List of colors used for widget areas according to their level.
Definition: ConfigWidget.hh:545
static const QString greenColor
Green color used for "green" or "y" fields.
Definition: ConfigWidget.hh:551
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:554
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:542
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:548
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
QWidget * geomLengthUnitLabel
A label for the unit of the length widget.
Definition: ConfigWidget.hh:97
Definition: ConfigWidget.hh:33
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