-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcombo_channeltype.cpp
More file actions
41 lines (33 loc) · 1.24 KB
/
combo_channeltype.cpp
File metadata and controls
41 lines (33 loc) · 1.24 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
#include "combo_channeltype.h"
ChannelTypeComboBox::ChannelTypeComboBox(QWidget *parent) : QComboBox(parent) {}
void ChannelTypeComboBox::setType(int channel)
{
// Generate the default options with associated values
// We use a different list depending on the channel, but they all get at least the switch option
switch (channel)
{
case 1:
this->insertItem(0, "Switch", CT_SWITCH);
this->insertItem(1, "Engine Speed", CT_ENGINE_SPEED);
break;
case 5:
this->insertItem(0, "Switch", CT_SWITCH);
this->insertItem(1, "Volume", CT_VOLUME);
break;
default:
this->insertItem(0, "Switch", CT_SWITCH);
}
// Connect to my custom signal
connect(this, SIGNAL(editTextChanged(QString)), this, SLOT(ChannelTypeChangedSlot(QString)));
connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(ChannelTypeChangedSlot(QString)));
}
void ChannelTypeComboBox::ChannelTypeChangedSlot(const QString )
{
// Send out custom signal with a pointer to this box
emit ChannelTypeChanged(this);
}
// This returns the current actual channel_function
channel_type ChannelTypeComboBox::getCurrentChannelType(void)
{
return channel_type(this->currentData().toInt());
}