-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqakaiapcminiwidget.cpp
More file actions
55 lines (44 loc) · 1.19 KB
/
qakaiapcminiwidget.cpp
File metadata and controls
55 lines (44 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "qakaiapcminiwidget.h"
#include <QGridLayout>
#define X_RANGE 9
#define Y_RANGE 9
#define CREATE_BUTTON(x,y) auto button##x##y = new QPushButton(this); \
layoutTotal->addWidget(button##x##y,x,y);
#define CREATE_SLIDER(y) auto slider##y = new QSlider(this); \
layoutTotal->addWidget(slider##y,X_RANGE,y); \
layoutTotal->setAlignment(slider##y, Qt::AlignHCenter);
// lighting apc mini buttons, 2nd data byte value
#define LIGHT_OFF 0;
// for rounded buttons
#define SINGLE_LIGHT_ON 1
#define SINGLE_LIGHT_BLINK 2
// for square buttons (except shift one)
#define GREEN_LIGHT_ON 1
#define GREEN_LIGHT_BLINK 2
#define RED_LIGHT_ON 3
#define RED_LIGHT_BLINK 4
#define YELLOW_LIGHT_ON 5
#define YELLOW_LIGHT_BLINK 6
QAkaiAPCMiniWidget::QAkaiAPCMiniWidget(QWidget *parent) :
QAbstractMidiControlerWidget(parent)
{
this->QAkaiAPCMiniWidget::drawWidget();
}
QAkaiAPCMiniWidget::~QAkaiAPCMiniWidget()
{}
void QAkaiAPCMiniWidget::drawWidget()
{
auto layoutTotal = new QGridLayout();
for (int i = 0; i < X_RANGE; i++)
{
for (int j = 0; j < Y_RANGE; j++)
{
CREATE_BUTTON(i,j)
}
}
for (int j = 0; j < Y_RANGE; j++)
{
CREATE_SLIDER(j)
}
setLayout(layoutTotal);
}