drumstick 2.7.2
pianokeybd.cpp
Go to the documentation of this file.
1/*
2 Virtual Piano Widget for Qt
3 Copyright (C) 2008-2022, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
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 along
16 with this program; If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#include <QApplication>
21#include "pianoscene.h"
22
34namespace drumstick { namespace widgets {
35
40 {Qt::Key_Z, 12},
41 {Qt::Key_S, 13},
42 {Qt::Key_X, 14},
43 {Qt::Key_D, 15},
44 {Qt::Key_C, 16},
45 {Qt::Key_V, 17},
46 {Qt::Key_G, 18},
47 {Qt::Key_B, 19},
48 {Qt::Key_H, 20},
49 {Qt::Key_N, 21},
50 {Qt::Key_J, 22},
51 {Qt::Key_M, 23},
52 {Qt::Key_Q, 24},
53 {Qt::Key_2, 25},
54 {Qt::Key_W, 26},
55 {Qt::Key_3, 27},
56 {Qt::Key_E, 28},
57 {Qt::Key_R, 29},
58 {Qt::Key_5, 30},
59 {Qt::Key_T, 31},
60 {Qt::Key_6, 32},
61 {Qt::Key_Y, 33},
62 {Qt::Key_7, 34},
63 {Qt::Key_U, 35},
64 {Qt::Key_I, 36},
65 {Qt::Key_9, 37},
66 {Qt::Key_O, 38},
67 {Qt::Key_0, 39},
68 {Qt::Key_P, 40}
69};
70
75#if defined(Q_OS_LINUX)
76 {94, 11},
77 {52, 12},
78 {39, 13},
79 {53, 14},
80 {40, 15},
81 {54, 16},
82 {55, 17},
83 {42, 18},
84 {56, 19},
85 {43, 20},
86 {57, 21},
87 {44, 22},
88 {58, 23},
89 {59, 24},
90 {46, 25},
91 {60, 26},
92 {47, 27},
93 {61, 28},
94
95 {24, 29},
96 {11, 30},
97 {25, 31},
98 {12, 32},
99 {26, 33},
100 {13, 34},
101 {27, 35},
102 {28, 36},
103 {15, 37},
104 {29, 38},
105 {16, 39},
106 {30, 40},
107 {31, 41},
108 {18, 42},
109 {32, 43},
110 {19, 44},
111 {33, 45},
112 {20, 46},
113 {34, 47},
114 {35, 48}
115#endif
116
117#if defined(Q_OS_WIN)
118 {86, 11},
119 {44, 12},
120 {31, 13},
121 {45, 14},
122 {32, 15},
123 {46, 16},
124 {47, 17},
125 {34, 18},
126 {48, 19},
127 {35, 20},
128 {49, 21},
129 {36, 22},
130 {50, 23},
131 {51, 24},
132 {38, 25},
133 {52, 26},
134 {39, 27},
135 {53, 28},
136
137 {16, 29},
138 {3, 30},
139 {17, 31},
140 {4, 32},
141 {18, 33},
142 {5, 34},
143 {19, 35},
144 {20, 36},
145 {7, 37},
146 {21, 38},
147 {8, 39},
148 {22, 40},
149 {23, 41},
150 {10, 42},
151 {24, 43},
152 {11, 44},
153 {25, 45},
154 {12, 46},
155 {26, 47},
156 {27, 48}
157#endif
158
159#if defined(Q_OS_MAC)
160 {50, 11},
161 {6, 12},
162 {1, 13},
163 {7, 14},
164 {2, 15},
165 {8, 16},
166 {9, 17},
167 {5, 18},
168 {11, 19},
169 {4, 20},
170 {45, 21},
171 {38, 22},
172 {46, 23},
173 {43, 24},
174 {37, 25},
175 {47, 26},
176 {41, 27},
177 {44, 28},
178
179 {12, 29},
180 {19, 30},
181 {13, 31},
182 {20, 32},
183 {14, 33},
184 {21, 34},
185 {15, 35},
186 {17, 36},
187 {22, 37},
188 {16, 38},
189 {26, 39},
190 {32, 40},
191 {34, 41},
192 {25, 42},
193 {31, 43},
194 {29, 44},
195 {35, 45},
196 {27, 46},
197 {33, 47},
198 {30, 48}
199#endif
200};
201
202class PianoKeybd::PianoKeybdPrivate {
203public:
204 PianoKeybdPrivate(): m_rotation(0), m_scene(nullptr), m_rawMap(nullptr)
205 { }
206 ~PianoKeybdPrivate() = default;
207
208 int m_rotation;
209 PianoScene *m_scene;
210 KeyboardMap *m_rawMap;
211};
212
220PianoKeybd::PianoKeybd(QWidget *parent)
221 : QGraphicsView(parent), d(new PianoKeybdPrivate())
222{
223 initialize();
225}
226
235PianoKeybd::PianoKeybd(const int baseOctave, const int numKeys, const int startKey, QWidget *parent)
236 : QGraphicsView(parent), d(new PianoKeybdPrivate)
237{
238 initialize();
239 initScene(baseOctave, numKeys, startKey);
240}
241
246{
247 d->m_scene->setRawKeyboardMode(false);
248 setKeyboardMap(nullptr);
249}
250
259{
260 return d->m_scene->getPianoHandler();
261}
262
272{
273 d->m_scene->setPianoHandler(handler);
274}
275
281{
282 return d->m_scene->getHighlightPalette();
283}
284
292{
293 d->m_scene->setHighlightPalette(p);
294}
295
301{
302 return d->m_scene->getBackgroundPalette();
303}
304
310{
311 d->m_scene->setBackgroundPalette(p);
312}
313
320{
321 return d->m_scene->getForegroundPalette();
322}
323
330{
331 d->m_scene->setForegroundPalette(p);
332}
333
339{
340 return d->m_scene->showColorScale();
341}
342
347void PianoKeybd::setShowColorScale(const bool show)
348{
349 d->m_scene->setShowColorScale(show);
350}
351
361void PianoKeybd::useCustomNoteNames(const QStringList &names)
362{
363 d->m_scene->useCustomNoteNames(names);
364}
365
371{
372 d->m_scene->useStandardNoteNames();
373}
374
380{
381 return d->m_scene->customNoteNames();
382}
383
389{
390 return d->m_scene->standardNoteNames();
391}
392
399{
400 d->m_scene->retranslate();
401}
402
410void PianoKeybd::initScene(int base, int num, int strt, const QColor& c)
411{
412 d->m_scene = new PianoScene(base, num, strt, c, this);
413 d->m_scene->setKeyboardMap(&g_DefaultKeyMap);
414 connect(d->m_scene, &PianoScene::noteOn, this, &PianoKeybd::noteOn);
415 connect(d->m_scene, &PianoScene::noteOff, this, &PianoKeybd::noteOff);
416 connect(d->m_scene, &PianoScene::signalName, this, &PianoKeybd::signalName);
417 setScene(d->m_scene);
418}
419
425{
426 setAttribute(Qt::WA_AcceptTouchEvents);
427 setAttribute(Qt::WA_InputMethodEnabled, false);
428 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
429 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
430 setViewportUpdateMode(MinimalViewportUpdate);
431 setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform);
432#if (QT_VERSION < QT_VERSION_CHECK(5,15,0))
433 setOptimizationFlag(DontClipPainter, true);
434#endif
435 setOptimizationFlag(DontSavePainterState, true);
436 setOptimizationFlag(DontAdjustForAntialiasing, true);
437}
438
444void PianoKeybd::resizeEvent(QResizeEvent *event)
445{
446 QGraphicsView::resizeEvent(event);
447 fitInView(d->m_scene->sceneRect(), Qt::KeepAspectRatio);
448}
449
457{
458#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
459 static const auto touchScreen = QTouchDevice::DeviceType::TouchScreen;
460#else
461 static const auto touchScreen = QInputDevice::DeviceType::TouchScreen;
462#endif
463 switch(ev->type()) {
464 case QEvent::TouchBegin:
465 case QEvent::TouchUpdate:
466 case QEvent::TouchEnd:
467 case QEvent::TouchCancel:
468 {
469 //qDebug() << Q_FUNC_INFO << ev->type();
470 QTouchEvent *touchEvent = static_cast<QTouchEvent*>(ev);
471 if (isTouchEnabled() && (touchEvent->device()->type() == touchScreen)) {
472 return d->m_scene->touchScreenEvent(touchEvent);
473 }
474 break;
475 }
476 default:
477 break;
478 }
479 return QGraphicsView::viewportEvent(ev);
480}
481
493void PianoKeybd::setNumKeys(const int numKeys, const int startKey)
494{
495 //qDebug() << Q_FUNC_INFO << numKeys << startKey;
496 if ( numKeys != d->m_scene->numKeys() || startKey != d->m_scene->startKey() )
497 {
498 QByteArray dataBuffer;
499 int baseOctave = d->m_scene->baseOctave();
500 QColor color = d->m_scene->getKeyPressedColor();
501 PianoHandler* handler = d->m_scene->getPianoHandler();
502 KeyboardMap* keyMap = d->m_scene->getKeyboardMap();
503 d->m_scene->saveData(dataBuffer);
504 delete d->m_scene;
505 initScene(baseOctave, numKeys, startKey, color);
506 d->m_scene->loadData(dataBuffer);
507 d->m_scene->setPianoHandler(handler);
508 d->m_scene->setKeyboardMap(keyMap);
509 d->m_scene->hideOrShowKeys();
510 d->m_scene->refreshKeys();
511 d->m_scene->refreshLabels();
512 fitInView(d->m_scene->sceneRect(), Qt::KeepAspectRatio);
513 }
514}
515
521{
522 if (r != d->m_rotation) {
523 d->m_rotation = r;
524 resetTransform();
525 rotate(d->m_rotation);
526 fitInView(d->m_scene->sceneRect(), Qt::KeepAspectRatio);
527 }
528}
529
535{
536 return mapFromScene(sceneRect()).boundingRect().size();
537}
538
539// RAWKBD_SUPPORT
541{
542 if (d->m_scene->isKeyboardEnabled() && d->m_rawMap != nullptr && d->m_rawMap->contains(keycode)) {
543 d->m_scene->keyOn(d->m_rawMap->value(keycode));
544 return true;
545 }
546 return false;
547}
548
550{
551 if (d->m_scene->isKeyboardEnabled() && d->m_rawMap != nullptr && d->m_rawMap->contains(keycode)) {
552 d->m_scene->keyOff(d->m_rawMap->value(keycode));
553 return true;
554 }
555 return false;
556}
557
564void PianoKeybd::setKeyPicture(const bool natural, const QPixmap &pix)
565{
566 d->m_scene->setKeyPicture(natural, pix);
567}
568
574QPixmap PianoKeybd::getKeyPicture(const bool natural)
575{
576 return d->m_scene->getKeyPicture(natural);
577}
578
583void PianoKeybd::setUseKeyPictures(const bool enable)
584{
585 d->m_scene->setUseKeyPictures(enable);
586}
587
593{
594 return d->m_scene->getUseKeyPictures();
595}
596
607void PianoKeybd::setUsingNativeFilter(const bool newState)
608{
609 d->m_scene->setUsingNativeFilter( newState );
610}
611
620{
621 return d->m_scene->isUsingNativeFilter();
622}
623
635void PianoKeybd::setOctaveSubscript(const bool enable)
636{
637 d->m_scene->setOctaveSubscript( enable );
638}
639
651{
652 return d->m_scene->octaveSubscript();
653}
654
666void PianoKeybd::setStartKey(const int startKey)
667{
668 setNumKeys(numKeys(), startKey);
669}
670
676int PianoKeybd::baseOctave() const
677{
678 return d->m_scene->baseOctave();
679}
680
685void PianoKeybd::setBaseOctave(const int baseOctave)
686{
687 d->m_scene->setBaseOctave(baseOctave);
688}
689
695int PianoKeybd::numKeys() const
696{
697 return d->m_scene->numKeys();
698}
699
704int PianoKeybd::startKey() const
705{
706 return d->m_scene->startKey();
707}
708
714{
715 return d->m_rotation;
716}
717
723{
724 return d->m_scene->getKeyPressedColor();
725}
726
734{
735 d->m_scene->setKeyPressedColor(c);
736}
737
742{
743 d->m_scene->resetKeyPressedColor();
744}
745
751LabelVisibility PianoKeybd::showLabels() const
752{
753 return d->m_scene->showLabels();
754}
755
762{
763 d->m_scene->setShowLabels(show);
764}
765
772{
773 return d->m_scene->alterations();
774}
775
782{
783 d->m_scene->setAlterations(use);
784}
785
791LabelOrientation PianoKeybd::labelOrientation() const
792{
793 return d->m_scene->getOrientation();
794}
795
802{
803 d->m_scene->setOrientation(orientation);
804}
805
811LabelCentralOctave PianoKeybd::labelOctave() const
812{
813 return d->m_scene->getOctave();
814}
815
822{
823 d->m_scene->setOctave(octave);
824}
825
832{
833 return d->m_scene->getTranspose();
834}
835
842{
843 d->m_scene->setTranspose(t);
844}
845
851{
852 return d->m_scene->getChannel();
853}
854
859void PianoKeybd::setChannel(const int c)
860{
861 d->m_scene->setChannel(c);
862}
863
870{
871 return d->m_scene->getVelocity();
872}
873
879void PianoKeybd::setVelocity(const int v)
880{
881 d->m_scene->setVelocity(v);
882}
883
889{
890 return d->m_scene->isKeyboardEnabled();
891}
892
897void PianoKeybd::setKeyboardEnabled(const bool enable)
898{
899 d->m_scene->setKeyboardEnabled(enable);
900}
901
907{
908 return d->m_scene->isMouseEnabled();
909}
910
915void PianoKeybd::setMouseEnabled(const bool enable)
916{
917 d->m_scene->setMouseEnabled(enable);
918}
919
925{
926 return d->m_scene->isTouchEnabled();
927}
928
933void PianoKeybd::setTouchEnabled(const bool enable)
934{
935 d->m_scene->setTouchEnabled(enable);
936}
937
943{
944 return d->m_scene->velocityTint();
945}
946
951void PianoKeybd::setVelocityTint(const bool enable)
952{
953 //qDebug() << Q_FUNC_INFO << enable;
954 d->m_scene->setVelocityTint(enable);
955}
956
961{
962 d->m_scene->allKeysOff();
963}
964
970{
971 d->m_scene->setKeyboardMap(m);
972}
973
979{
980 return d->m_scene->getKeyboardMap();
981}
982
987{
988 d->m_rawMap = &g_DefaultRawKeyMap;
989 d->m_scene->setKeyboardMap(&g_DefaultRawKeyMap);
990}
991
997{
998 return d->m_scene->getRawKeyboardMode();
999}
1000
1006{
1007 d->m_scene->setRawKeyboardMode(b);
1008}
1009
1014{
1015 d->m_scene->setKeyboardMap(&g_DefaultKeyMap);
1016}
1017
1023{
1024 d->m_rawMap = m;
1025 d->m_scene->setKeyboardMap(m);
1026}
1027
1033{
1034 return d->m_rawMap;
1035}
1036
1043void PianoKeybd::showNoteOn(const int note, QColor color, int vel)
1044{
1045 d->m_scene->showNoteOn(note, color, vel);
1046}
1047
1053void PianoKeybd::showNoteOn(const int note, int vel)
1054{
1055 d->m_scene->showNoteOn(note, vel);
1056}
1057
1063void PianoKeybd::showNoteOff(const int note, int vel)
1064{
1065 d->m_scene->showNoteOff(note, vel);
1066}
1067
1072void PianoKeybd::setFont(const QFont &font)
1073{
1074 QWidget::setFont(font);
1075 d->m_scene->setFont(font);
1076 d->m_scene->refreshLabels();
1077}
1078
1079} // namespace widgets
1080} // namespace drumstick
The QEvent class is the base class of all event classes.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
The PianoHandler class callbacks.
Definition: pianokeybd.h:74
void initScene(int base, int num, int ini, const QColor &c=QColor())
Creates and initializes a new PianoScene instance and assigns it to this widget.
Definition: pianokeybd.cpp:410
void allKeysOff()
Forces all active notes to silence.
Definition: pianokeybd.cpp:960
virtual ~PianoKeybd()
Destructor.
Definition: pianokeybd.cpp:245
void resetKeyPressedColor()
Assigns the default highlight palette colors and assigns it to the scene.
Definition: pianokeybd.cpp:741
bool handleKeyReleased(int keycode) override
handleKeyReleased handles low level computer keyboard reelase events
Definition: pianokeybd.cpp:549
void setNumKeys(const int numKeys, const int startKey=DEFAULTSTARTINGKEY)
This method changes the number of displayed keys and the starting key number, keeping the other setti...
Definition: pianokeybd.cpp:493
PianoKeybd(QWidget *parent=nullptr)
Constructor.
Definition: pianokeybd.cpp:220
bool octaveSubscript() const
Returns whether the octave subscript designation is enabled.
Definition: pianokeybd.cpp:650
void setBackgroundPalette(const PianoPalette &p)
Assigns the palette used to paint the keys' background.
Definition: pianokeybd.cpp:309
void setRawKeyboardMode(const bool b)
Enables or disables the low level computer keyboard mode.
void setFont(const QFont &font)
Assigns a typographic font for drawing the note labels over the piano keys.
void initialize()
This method is called from the available constructors to initialize some widget attributes,...
Definition: pianokeybd.cpp:424
QSize sizeHint() const override
Overrides QGraphicsView::sizeHint() providing a size value based on the piano scene.
Definition: pianokeybd.cpp:534
void useStandardNoteNames()
Disables the custom note names usage as labels over the keys, and restores the standard note names in...
Definition: pianokeybd.cpp:370
bool isKeyboardEnabled() const
Returns whether the computer keyboard is enabled.
Definition: pianokeybd.cpp:888
void resetKeyboardMap()
Resets the low level computer keyboard note map to the default one.
void setKeyPressedColor(const QColor &c)
Assigns a single color for key highlight.
Definition: pianokeybd.cpp:733
void setChannel(const int c)
Assigns the MIDI Channel (0-15).
Definition: pianokeybd.cpp:859
PianoPalette getForegroundPalette() const
Returns the palette used to paint texts over the keys like the note names or custom labels.
Definition: pianokeybd.cpp:319
bool getUseKeyPictures() const
Returns whether pictures are used to paint the keys.
Definition: pianokeybd.cpp:592
void setHighlightPalette(const PianoPalette &p)
Assigns the palette used for highlighting the played keys.
Definition: pianokeybd.cpp:291
void setShowColorScale(const bool show)
Enables or disables the color scale background palette.
Definition: pianokeybd.cpp:347
void setPianoHandler(PianoHandler *handler)
Assigns a PianoHandler pointer for processing note events.
Definition: pianokeybd.cpp:271
void setLabelOctave(const LabelCentralOctave octave)
Assigns the octave label policy.
Definition: pianokeybd.cpp:821
bool showColorScale() const
Returns true if the color scale background palette is assigned and active.
Definition: pianokeybd.cpp:338
void signalName(const QString &name)
signalName is emitted for each note created, and contains a string with the MIDI note number and the ...
void setKeyboardEnabled(const bool enable)
Enables or disables the computer keyboard note input.
Definition: pianokeybd.cpp:897
KeyboardMap * getRawKeyboardMap()
Returns the low level computer keyboard note map.
PianoPalette getBackgroundPalette() const
Returns the palette used to paint the keys' background.
Definition: pianokeybd.cpp:300
bool isUsingNativeFilter() const
Returns whether the application is filtering native events.
Definition: pianokeybd.cpp:619
void setRawKeyboardMap(KeyboardMap *m)
Assigns the low level computer keyboard note map.
int getChannel() const
Returns the MIDI Channel (0-15).
Definition: pianokeybd.cpp:850
void setBaseOctave(const int baseOctave)
Assigns the base octave number.
Definition: pianokeybd.cpp:685
void setForegroundPalette(const PianoPalette &p)
Assigns the palette used to paint texts over the keys like the note names or custom labels.
Definition: pianokeybd.cpp:329
void setVelocityTint(const bool enable)
Enables or disables the note MIDI velocity influencing the highlight color tint.
Definition: pianokeybd.cpp:951
void setLabelAlterations(const LabelAlteration use)
Assigns the label alterations policy.
Definition: pianokeybd.cpp:781
void setStartKey(const int startKey)
Sets the initial/starting note key.
Definition: pianokeybd.cpp:666
void setKeyPicture(const bool natural, const QPixmap &pix)
Assigns a custom picture to the white or black keys that will be used as a texture to paint the keys.
Definition: pianokeybd.cpp:564
bool velocityTint() const
Returns whether the note MIDI velocity influences the highlight color tint.
Definition: pianokeybd.cpp:942
void setUsingNativeFilter(const bool newState)
Enables or disables the application level usage of a native event filter.
Definition: pianokeybd.cpp:607
QColor getKeyPressedColor() const
Returns the key highlight color.
Definition: pianokeybd.cpp:722
void resizeEvent(QResizeEvent *event) override
This method overrides QGraphicsView::resizeEvent() to keep the aspect ratio of the keys scene when th...
Definition: pianokeybd.cpp:444
void noteOff(int midiNote, int vel)
This signal is emitted for each Note Off MIDI event created using the computer keyboard,...
bool handleKeyPressed(int keycode) override
handleKeyPressed handles low level computer keyboard press events
Definition: pianokeybd.cpp:540
void setKeyboardMap(KeyboardMap *m)
Assigns the computer keyboard note map.
Definition: pianokeybd.cpp:969
void showNoteOff(const int note, int vel=-1)
Shows inactive one note key with the specified velocity.
void setShowLabels(const LabelVisibility show)
Assigns the label visibility policy.
Definition: pianokeybd.cpp:761
LabelAlteration labelAlterations() const
Returns the label alterations policy.
Definition: pianokeybd.cpp:771
PianoPalette getHighlightPalette() const
Returns the palette used for highlighting the played keys.
Definition: pianokeybd.cpp:280
QStringList standardNoteNames() const
Returns the list of standard note names.
Definition: pianokeybd.cpp:388
void noteOn(int midiNote, int vel)
This signal is emitted for each Note On MIDI event created using the computer keyboard,...
void resetRawKeyboardMap()
Resets the computer keyboard note map to the default one.
Definition: pianokeybd.cpp:986
PianoHandler * getPianoHandler() const
Gets the PianoHandler pointer to the note receiver.
Definition: pianokeybd.cpp:258
void setLabelOrientation(const LabelOrientation orientation)
Assigns the labels orientation policy.
Definition: pianokeybd.cpp:801
bool isMouseEnabled() const
Returns whether the mouse note input is enabled.
Definition: pianokeybd.cpp:906
bool getRawKeyboardMode() const
Returns the low level computer keyboard note map.
Definition: pianokeybd.cpp:996
void showNoteOn(const int note, QColor color, int vel=-1)
Highlights one note key with the specified color and velocity.
void setRotation(int r)
Rotates the keyboard view an angle clockwise.
Definition: pianokeybd.cpp:520
QPixmap getKeyPicture(const bool natural)
Returns the custom picture used to paint the corresponding keys.
Definition: pianokeybd.cpp:574
void retranslate()
Updates the standard names of notes according to the currently active program language translation.
Definition: pianokeybd.cpp:398
void setTouchEnabled(const bool enable)
Enables or disables the touch screen note input.
Definition: pianokeybd.cpp:933
void useCustomNoteNames(const QStringList &names)
Assigns a list of custom text labels to be displayer over the keys.
Definition: pianokeybd.cpp:361
void setMouseEnabled(const bool enable)
Enables or disables the mouse note input.
Definition: pianokeybd.cpp:915
KeyboardMap * getKeyboardMap()
Returns the computer keyboard note map.
Definition: pianokeybd.cpp:978
void setUseKeyPictures(const bool enable)
Enables or disables a picture to paint the keys.
Definition: pianokeybd.cpp:583
int getRotation() const
Returns the rotation angle in degrees, clockwise, of the piano view.
Definition: pianokeybd.cpp:713
void setTranspose(int t)
Assigns the transpose amount in semitones.
Definition: pianokeybd.cpp:841
QStringList customNoteNames() const
Returns the list of custom note names.
Definition: pianokeybd.cpp:379
int getVelocity() const
Returns the MIDI note velocity.
Definition: pianokeybd.cpp:869
void setVelocity(const int v)
Assigns the MIDI note velocity.
Definition: pianokeybd.cpp:879
bool viewportEvent(QEvent *ev) override
This method overrides QGraphicsView::viewportEvent() Only touchscreen events are processed here.
Definition: pianokeybd.cpp:456
void setOctaveSubscript(const bool enable)
Enables or disables the octave subscript designation.
Definition: pianokeybd.cpp:635
bool isTouchEnabled() const
Returns whether the touch screen note input is enabled.
Definition: pianokeybd.cpp:924
int getTranspose() const
Returns the transpose amount in semitones.
Definition: pianokeybd.cpp:831
The PianoPalette class.
Definition: pianopalette.h:61
The PianoScene class is a QGraphicsScene composed by a number of graphics items: the piano keys.
Definition: pianoscene.h:47
void noteOff(int n, int v)
This signal is emitted for each Note Off MIDI event created using the computer keyboard,...
void signalName(const QString &name)
signalName is emitted for each note created, and contains a string with the MIDI note number and the ...
void noteOn(int n, int v)
This signal is emitted for each Note On MIDI event created using the computer keyboard,...
LabelAlteration
Labels for Alterations.
Definition: pianokeybd.h:121
DRUMSTICK_EXPORT KeyboardMap g_DefaultKeyMap
Global Key Map Variable.
Definition: pianokeybd.cpp:39
LabelCentralOctave
Labels Central Octave.
Definition: pianokeybd.h:151
LabelVisibility
Labels Visibility.
Definition: pianokeybd.h:110
const int DEFAULTNUMBEROFKEYS
Default number of piano keys.
Definition: pianokeybd.h:105
LabelOrientation
Labels Orientation.
Definition: pianokeybd.h:131
const int DEFAULTSTARTINGKEY
Default starting key (A)
Definition: pianokeybd.h:103
QHash< int, int > KeyboardMap
KeyboardMap.
Definition: pianokeybd.h:98
DRUMSTICK_EXPORT KeyboardMap g_DefaultRawKeyMap
Global Raw Key Map Variable.
Definition: pianokeybd.cpp:74
const int DEFAULTBASEOCTAVE
Default base octave.
Definition: pianokeybd.h:104
Drumstick common.
Definition: alsaclient.cpp:68
Piano Keyboard Widget.
PianoScene class declaration.