configfavoritebutton.cpp
904 Bytes
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
#include "configfavoritebutton.h"
#include "ui_configfavoritebutton.h"
#include "soundplayer.h"
ConfigFavoriteButton::ConfigFavoriteButton(QWidget *parent,uint16_t btn_id) :
QWidget(parent),
ui(new Ui::ConfigFavoriteButton)
{
ui->setupUi(this);
btnid = btn_id;
foreach (QPushButton *button, findChildren<QPushButton *>())
connect(button, &QPushButton::pressed, SoundPlayer::playClick);
}
ConfigFavoriteButton::~ConfigFavoriteButton()
{
delete ui;
}
void ConfigFavoriteButton::setText(const QString &text){
ui->pushButton->setText(text);
}
QWidget *ConfigFavoriteButton::getBtn()
{
return ui->pushButton;
}
QWidget* ConfigFavoriteButton::getDelBtn(){
return ui->favoriteButton;
}
void ConfigFavoriteButton::on_favoriteButton_clicked()
{
emit delBtnClicked(btnid);
}
void ConfigFavoriteButton::on_pushButton_clicked()
{
emit clicked(btnid);
}