#include "Setting.h" #include "ui_Setting.h" Setting::Setting(QWidget *parent) : QWidget(parent), ui(new Ui::Setting) { ui->setupUi(this); setWindowTitle(tr("Setting")); //load qss QFile file(":/qss/Setting.qss"); file.open(QFile::ReadOnly); QTextStream filetext(&file); QString stylesheet = filetext.readAll(); this->setStyleSheet(stylesheet); file.close(); index0 = new Index0(this); index1 = new Index1(this);; connect(this,SIGNAL(IndexChanged(int)), this,SLOT(onTabIndexChanged(int))); CurrentIndex = 0; emit IndexChanged(CurrentIndex); } Setting::~Setting() { if(index0) { delete index0; } if(index1) { delete index1; } delete ui; } void Setting::resizeEvent(QResizeEvent *event) { Q_UNUSED(event) index0->setGeometry(ui->frame->geometry()); index1->setGeometry(ui->frame->geometry()); update(); } void Setting::onTabIndexChanged(const int &index)//界面选择管理 { //软件设置 if(index == 0) index0->show(); else index0->hide(); //硬件设置 if(index == 1) index1->show(); else index1->hide(); } void Setting::on_pushButton_software_clicked() { CurrentIndex = 0; emit IndexChanged(CurrentIndex); } void Setting::on_pushButton_plane_clicked() { CurrentIndex = 1; emit IndexChanged(CurrentIndex); }