MuseScore  3.4
Music composition and notation
palettewidget.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2019 Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __PALETTEWIDGET_H__
21 #define __PALETTEWIDGET_H__
22 
23 #include "qmldockwidget.h"
24 
25 namespace Ms {
26 
27 class PaletteWorkspace;
28 class QmlNativeToolTip;
29 
30 //---------------------------------------------------------
31 // PaletteQmlInterface
32 //---------------------------------------------------------
33 
34 class PaletteQmlInterface : public QObject
35  {
36  Q_OBJECT
37 
42 
47 
49 
50  signals:
56 
57  public:
58  PaletteQmlInterface(PaletteWorkspace* workspace, QmlNativeToolTip* t, bool enabled, QObject* parent = nullptr);
59 
61  const PaletteWorkspace* paletteWorkspace() const { return w; }
62  void setPaletteWorkspace(PaletteWorkspace* workspace) { w = workspace; emit paletteWorkspaceChanged(); }
63 
64  QColor paletteBackground() const { return _paletteBackground; }
65  void setPaletteBackground(const QColor& val);
66 
67  bool palettesEnabled() const { return _palettesEnabled; }
68  void setPalettesEnabled(bool val);
69 
71 
73 
74  Q_INVOKABLE Qt::KeyboardModifiers keyboardModifiers() const { return QGuiApplication::keyboardModifiers(); }
75  };
76 
77 //---------------------------------------------------------
78 // PaletteWidget
79 //---------------------------------------------------------
80 
82  {
83  Q_OBJECT
84 
85  QAction* singlePaletteAction = nullptr;
87 
88  bool wasShown = false;
89 
90  static void registerQmlTypes();
91 
92  void retranslate();
93  void setupStyle();
94 
95  public slots:
96  void setSinglePalette(bool);
97 
98  public:
99  PaletteWidget(PaletteWorkspace* w, QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
100  PaletteWidget(PaletteWorkspace* w, QQmlEngine* e, QWidget* parent, Qt::WindowFlags flags = Qt::WindowFlags());
101 
102  void activateSearchBox();
103  void applyCurrentPaletteElement();
105 
106  void showEvent(QShowEvent* event) override;
107  void changeEvent(QEvent* evt) override;
108  };
109 
110 }
111 #endif
112 
Definition: paletteworkspace.h:167
PaletteQmlInterface(PaletteWorkspace *workspace, QmlNativeToolTip *t, bool enabled, QObject *parent=nullptr)
Definition: palettewidget.cpp:36
Definition: palettewidget.h:34
void setPaletteBackground(const QColor &val)
Definition: palettewidget.cpp:46
PaletteWorkspace * paletteWorkspace()
Definition: palettewidget.h:60
void notifyElementDraggedToScoreView()
Definition: palettewidget.h:70
bool _palettesEnabled
Definition: palettewidget.h:46
void setPalettesEnabled(bool val)
Definition: palettewidget.cpp:58
QColor _paletteBackground
Definition: palettewidget.h:45
Definition: nativetooltip.h:29
Q_INVOKABLE Qt::KeyboardModifiers keyboardModifiers() const
Definition: palettewidget.h:74
PaletteQmlInterface * qmlInterface
Definition: palettewidget.h:86
const PaletteWorkspace * paletteWorkspace() const
Definition: palettewidget.h:61
Definition: aeolus.cpp:26
QColor paletteBackground() const
Definition: palettewidget.h:64
Definition: palettewidget.h:81
void setPaletteWorkspace(PaletteWorkspace *workspace)
Definition: palettewidget.h:62
Ms::QmlNativeToolTip tooltip
Definition: palettewidget.h:40
bool palettesEnabled() const
Definition: palettewidget.h:67
Definition: qmldockwidget.h:144
QmlNativeToolTip * getTooltip()
Definition: palettewidget.h:48
PaletteWorkspace * w
Definition: palettewidget.h:43
void requestPaletteSearch()
Definition: palettewidget.h:72