1 /* 2 Virtual Piano Widget for Qt5 3 Copyright (C) 2008-2021, 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 #ifndef KEYLABEL_H 20 #define KEYLABEL_H 21 22 #include <QGraphicsTextItem> 23 #include <drumstick/pianokeybd.h> 24 25 /** 26 * @file keylabel.h 27 * Declaration of the KeyLabel class 28 */ 29 30 namespace drumstick { 31 namespace widgets { 32 33 class KeyLabel : public QGraphicsTextItem 34 { 35 public: 36 explicit KeyLabel(QGraphicsItem *parent = nullptr); 37 virtual ~KeyLabel() = default; 38 void setPlainText(const QString& text); 39 void adjust(); 40 void setOrientation(LabelOrientation ori); 41 void restoreColor(); 42 43 private: 44 LabelOrientation m_orientation = HorizontalOrientation; 45 void calculateRotation(); 46 47 QColor m_savedColor; 48 }; 49 50 }} // namespace drumstick::widgets 51 52 #endif // KEYLABEL_H 53