Sceneview
 All Classes Functions Variables Enumerations Enumerator Groups Pages
expander_widget.hpp
1 // Copyright [2015] Albert Huang
2 
3 #ifndef SCENEVIEW_EXPANDER_WIDGET_HPP__
4 #define SCENEVIEW_EXPANDER_WIDGET_HPP__
5 
6 #include <QWidget>
7 
8 class QPushButton;
9 class QStackedWidget;
10 class QVBoxLayout;
11 
12 namespace sv {
13 
20 class ExpanderWidget : public QWidget {
21  Q_OBJECT
22 
23  public:
24  explicit ExpanderWidget(QWidget* parent = nullptr);
25 
26  void SetWidget(QWidget* widget);
27 
28  QSize sizeHint() const override;
29 
30  void SetTitle(const QString& title);
31  QString Title() const;
32 
33  void SetExpanded(bool val);
34  bool Expanded() const { return expanded_; }
35 
36  private slots:
37  void ToggleExpanded();
38 
39  private:
40  QPushButton* button_;
41  QWidget* widget_;
42  QVBoxLayout* layout_;
43  bool expanded_;
44 };
45 
46 } // namespace sv
47 
48 #endif // SCENEVIEW_EXPANDER_WIDGET_HPP__
Hides or shows a contained widget.
Definition: expander_widget.hpp:20