Loading...
Searching...
No Matches
PanelDelegate.hpp
1#pragma once
2#include <score/document/DocumentContext.hpp>
3#include <score/tools/std/Optional.hpp>
4
5#include <QIcon>
6#include <QKeySequence>
7
8#include <score_lib_base_export.h>
9class Selection;
10namespace score
11{
12struct GUIApplicationContext;
13struct DocumentContext;
14class PanelModel;
15class PanelView;
16
23struct SCORE_LIB_BASE_EXPORT PanelStatus
24{
26 bool isShown, bool fixed, Qt::DockWidgetArea d, int prio, QString name,
27 QString icon, const QKeySequence& sc);
28
29 const bool shown; // Controls if it is shown by default.
30 const bool fixed;
31 const Qt::DockWidgetArea dock; // Which dock.
32 const int priority; // Higher priority will come up first.
33 const QString prettyName; // Used in the header.
34 const QIcon icon; // Same
35 const QKeySequence shortcut; // Keyboard shortcut to show or hide the panel.
36};
37
49class SCORE_LIB_BASE_EXPORT PanelDelegate
50{
51public:
53 virtual ~PanelDelegate();
54
55 const score::GUIApplicationContext& context() const;
56
57 void setModel(const score::DocumentContext& model);
58 void setModel(std::nullopt_t n);
59
65 MaybeDocument document() const;
66
71 virtual QWidget* widget() = 0;
72
76 virtual const PanelStatus& defaultPanelStatus() const = 0;
77
85 virtual void setNewSelection(const Selection& s);
86
87protected:
94 virtual void on_modelChanged(MaybeDocument oldm, MaybeDocument newm);
95
96private:
97 const score::GUIApplicationContext& m_context;
98 MaybeDocument m_model{};
99};
100}
Definition Selection.hpp:12
The PanelDelegate class.
Definition PanelDelegate.hpp:50
virtual QWidget * widget()=0
widget The widget of the panel.
virtual const PanelStatus & defaultPanelStatus() const =0
defaultPanelStatus Metadata of the panel.
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition DocumentContext.hpp:18
Specializes ApplicationContext with the QMainWindow.
Definition GUIApplicationContext.hpp:15
The PanelStatus struct.
Definition PanelDelegate.hpp:24