MuseScore  3.4
Music composition and notation
drumview.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Score
3 // Linux Music Score Editor
4 //
5 // Copyright (C) 2010 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 __DRUMVIEW_H__
21 #define __DRUMVIEW_H__
22 
23 #include "libmscore/pos.h"
24 
25 namespace Ms {
26 
27 class Staff;
28 class Score;
29 class Note;
30 
31 //---------------------------------------------------------
32 // DrumItem
33 //---------------------------------------------------------
34 
35 class DrumItem : public QGraphicsPolygonItem {
37 
38  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
39 
40  public:
41  DrumItem(Note*);
42  };
43 
44 //---------------------------------------------------------
45 // DrumView
46 //---------------------------------------------------------
47 
48 class DrumView : public QGraphicsView {
49  Q_OBJECT
50 
54  QGraphicsLineItem* locatorLines[3];
55  int ticks;
57  int magStep;
58 
59  virtual void drawBackground(QPainter* painter, const QRectF& rect);
60 
61  int y2pitch(int y) const;
62  Pos pix2pos(int x) const;
63  int pos2pix(const Pos& p) const;
64 
65  protected:
66  virtual void wheelEvent(QWheelEvent* event);
67  virtual void mouseMoveEvent(QMouseEvent* event);
68  virtual void leaveEvent(QEvent*);
69 
70  signals:
71  void magChanged(double, double);
72  void xposChanged(int);
73  void pitchChanged(int);
74  void posChanged(const Pos&);
75 
76  public slots:
77  void moveLocator(int);
78 
79  public:
80  DrumView();
81  void setStaff(Staff*, Pos* locator);
82  void ensureVisible(int tick);
83  QList<QGraphicsItem*> items() { return scene()->selectedItems(); }
84  };
85 
86 
87 
88 } // namespace Ms
89 #endif
Global staff data not directly related to drawing.
Definition: staff.h:62
int y2pitch(qreal y, ClefType clef, qreal _spatium)
Definition: utils.cpp:404
Definition: drumview.h:35
int magStep
Definition: drumview.h:57
Pos pos
Definition: drumview.h:52
int ticks
Definition: drumview.h:55
Definition: drumview.h:48
DrumItem(Note *)
Definition: drumview.cpp:53
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: drumview.cpp:74
QList< QGraphicsItem * > items()
Definition: drumview.h:83
Pos * _locator
Definition: drumview.h:53
Definition: aeolus.cpp:26
Staff * staff
Definition: drumview.h:51
Graphic representation of a note.
Definition: note.h:212
Note * _note
Definition: drumview.h:36
TType
Definition: pos.h:32
TType _timeType
Definition: drumview.h:56
Definition: pos.h:42