RecordControlApplication/Menu.cpp

38 lines
799 B
C++
Executable File

#include "Menu.h"
#include "Constant.h"
#include "ui_Menu.h"
Menu::Menu(QWidget* parent)
: QWidget(parent)
, ui(new Ui::Menu)
{
ui->setupUi(this);
ui->btnChannelA->setChecked(true);
QPoint globalPos = parent->mapToGlobal(QPoint(0, 0));
int x = globalPos.x() + (parent->width() - this->width()) / 2;
int y = globalPos.y() + (parent->height() - this->height()) / 2;
this->move(x, y);
}
Menu::~Menu()
{
delete ui;
}
QString Menu::getCurChannel()
{
if (ui->btnChannelA->isChecked())
return Constant::MainChannel;
else
return Constant::SecondaryChannel;
}
void Menu::setCurChannel(QString channel)
{
if (channel == Constant::MainChannel)
ui->btnChannelA->setChecked(true);
else
ui->btnChannelB->setChecked(true);
}