basicsettingwindow.cpp 863 Bytes
#include "basicsettingwindow.h"
#include "ui_basicsettingwindow.h"

#include "soundplayer.h"

BasicSettingWindow::BasicSettingWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::BasicSettingWindow)
{
    ui->setupUi(this);

    foreach (QPushButton *button, findChildren<QPushButton *>())
        connect(button, &QPushButton::pressed, SoundPlayer::playClick);
}

BasicSettingWindow::~BasicSettingWindow()
{
    delete ui;
}

void BasicSettingWindow::keyPressEvent(QKeyEvent *event)
{

}

void BasicSettingWindow::keyReleaseEvent(QKeyEvent *event)
{

}

void BasicSettingWindow::onEncoderLeft()
{
    focusPreviousChild();
}

void BasicSettingWindow::onEncoderRight()
{
    focusNextChild();
}

void BasicSettingWindow::onEncoderClicked(QWidget *clicked)
{
    QPushButton *b = qobject_cast<QPushButton *>(clicked);
    if (b)
        b->click();
}