RecordControlApplication/Menu.cpp

38 lines
799 B
C++
Raw Normal View History

2024-01-18 15:41:43 +08:00
#include "Menu.h"
2024-03-04 16:22:40 +08:00
#include "Constant.h"
2024-01-18 15:41:43 +08:00
#include "ui_Menu.h"
Menu::Menu(QWidget* parent)
: QWidget(parent)
, ui(new Ui::Menu)
{
ui->setupUi(this);
ui->btnChannelA->setChecked(true);
2024-01-19 09:04:21 +08:00
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);
2024-01-18 15:41:43 +08:00
}
Menu::~Menu()
{
delete ui;
}
QString Menu::getCurChannel()
{
if (ui->btnChannelA->isChecked())
2024-03-04 16:22:40 +08:00
return Constant::MainChannel;
2024-01-18 15:41:43 +08:00
else
2024-03-04 16:22:40 +08:00
return Constant::SecondaryChannel;
2024-01-18 15:41:43 +08:00
}
void Menu::setCurChannel(QString channel)
{
2024-03-04 16:22:40 +08:00
if (channel == Constant::MainChannel)
2024-01-18 15:41:43 +08:00
ui->btnChannelA->setChecked(true);
else
ui->btnChannelB->setChecked(true);
}