configfavoritebutton.cpp 754 Bytes
#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);
}



void ConfigFavoriteButton::on_favoriteButton_clicked()
{
    emit delBtnClicked(btnid);
}

void ConfigFavoriteButton::on_pushButton_clicked()
{
    emit clicked(btnid);
}