InspectorSectionWidget.hpp
1 #pragma once
2 #include <score/widgets/ArrowButton.hpp>
3 #include <score/widgets/MarginLess.hpp>
4 
5 #include <QLineEdit>
6 #include <QPushButton>
7 #include <QString>
8 #include <QToolButton>
9 #include <QVBoxLayout>
10 #include <QWidget>
11 
12 #include <score_lib_inspector_export.h>
13 
14 #include <verdigris>
15 class QMenu;
16 
17 namespace Inspector
18 {
19 class SCORE_LIB_INSPECTOR_EXPORT MenuButton final : public QToolButton
20 {
21 public:
22  MenuButton(QWidget* parent);
23 };
24 
32 class SCORE_LIB_INSPECTOR_EXPORT InspectorSectionWidget : public QWidget
33 {
34  W_OBJECT(InspectorSectionWidget)
35 public:
36  explicit InspectorSectionWidget(bool editable = false, QWidget* parent = nullptr);
38  QString name, bool nameEditable = false, QWidget* parent = nullptr);
39  virtual ~InspectorSectionWidget();
40 
41  QMenu* menu() const { return m_menu; }
42  QString name() const;
43 
44  // Display tool
45  void expand(bool b);
46 
47  // Manage section
49  void renameSection(QString newName);
50 
52  void addContent(QWidget* newWidget);
53 
55  void removeContent(QWidget* toRemove);
56 
57  void removeAll();
58  void showMenu(bool b);
59 
60 public:
61  void nameChanged(QString newName)
62  E_SIGNAL(SCORE_LIB_INSPECTOR_EXPORT, nameChanged, newName)
63 
64 private:
65  score::MarginLess<QVBoxLayout> m_generalLayout;
67  QWidget m_title;
68  score::MarginLess<QHBoxLayout> m_titleLayout;
69 
70  score::ArrowButton m_unfoldBtn;
72  QPushButton m_buttonTitle;
73  QLineEdit m_sectionTitle;
74  MenuButton m_menuBtn;
75  QMenu* m_menu{};
76 
77  bool m_isUnfolded{};
78 };
79 }
InspectorSectionWidget is widget that can fold or unfold his content.
Definition: InspectorSectionWidget.hpp:33
Definition: InspectorSectionWidget.hpp:20
Definition: ArrowButton.hpp:11
Classes used for making and extending the inspector (default right panel).
Definition: lib/score/widgets/Layout.hpp:27