#include "Menu.h" #include "ui_Menu.h" Menu::Menu(QWidget* parent) : QWidget(parent) , ui(new Ui::Menu) { ui->setupUi(this); ui->btnChannelA->setChecked(true); // 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); } 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); }