RecordControlApplication/Menu.cpp

38 lines
755 B
C++
Raw Normal View History

2024-01-18 15:41:43 +08:00
#include "Menu.h"
#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
// move to center
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())
return "HDMI-A";
else
return "HDMI-B";
}
void Menu::setCurChannel(QString channel)
{
if (channel == "HDMI-A")
ui->btnChannelA->setChecked(true);
else
ui->btnChannelB->setChecked(true);
}