forked from LMMS/lmms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fff10f2
commit f0fdfa1
Showing
5 changed files
with
185 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* SlicerTKnob.cpp | ||
* | ||
* Copyright (c) 2023 Daniel Kauss Serna <daniel.kauss.serna@gmail.com> | ||
* | ||
* This file is part of LMMS - https://lmms.io | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program (see COPYING); if not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA. | ||
* | ||
*/ | ||
|
||
#include "SlicerTKnob.h" | ||
|
||
#include <QPaintEvent> | ||
#include <QPainter> | ||
|
||
namespace lmms::gui { | ||
SlicerTKnob::SlicerTKnob(QWidget* parent) | ||
: Knob(KnobType::Styled, parent) | ||
{ | ||
setFixedSize(50, 20); | ||
setCenterPointX(24.0); | ||
setCenterPointY(15.0); | ||
} | ||
|
||
void SlicerTKnob::paintEvent(QPaintEvent* event) | ||
{ | ||
auto brush = QPainter{this}; | ||
brush.translate(width() / 2.0f, height() / 2.0f); | ||
|
||
// int kor = 15; // knob outer radius | ||
// int kir = 9; // knob inner radius | ||
|
||
// // draw knob backgrounds | ||
// brush.setRenderHint(QPainter::Antialiasing); | ||
|
||
// // draw outer radius 2 times to make smooth | ||
// brush.setPen(QPen(QColor(159, 124, 223, 100), 4)); | ||
// brush.drawArc(QRect(kor, 0, kor * 2, kor * 2), -45 * 16, 270 * 16); | ||
|
||
// brush.setPen(QPen(QColor(159, 124, 223, 255), 2)); | ||
// brush.drawArc(QRect(kor, 0, kor * 2, kor * 2), -45 * 16, 270 * 16); | ||
|
||
// // inner knob circle | ||
// brush.setBrush(QColor(106, 90, 138)); | ||
// brush.setPen(QColor(0, 0, 0, 0)); | ||
// brush.drawEllipse(QPoint(0, 15), kir, kir); | ||
|
||
Knob::paintEvent(event); | ||
} | ||
} // namespace lmms::gui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* SlicerTKnob.h | ||
* | ||
* Copyright (c) 2024 saker | ||
* | ||
* This file is part of LMMS - https://lmms.io | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program (see COPYING); if not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA. | ||
* | ||
*/ | ||
|
||
#ifndef LMMS_SLICERT_KNOB_H | ||
#define LMMS_SLICERT_KNOB_H | ||
|
||
#include <QWidget> | ||
#include "Knob.h" | ||
|
||
namespace lmms::gui { | ||
class SlicerTKnob : public Knob | ||
{ | ||
public: | ||
SlicerTKnob(QWidget* parent); | ||
void paintEvent(QPaintEvent* event) override; | ||
}; | ||
} // namespace lmms::gui | ||
|
||
#endif // LMMS_SLICERT_KNOB_H |
Oops, something went wrong.