b
This commit is contained in:
+102
-102
@@ -1,102 +1,102 @@
|
||||
#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)));
|
||||
|
||||
|
||||
setPushButtonState(state::Selected,
|
||||
state::unSelected);
|
||||
|
||||
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::setPushButtonState(uint8_t state1,uint8_t state2)
|
||||
{
|
||||
ui->pushButton_software->setProperty("state",state1);
|
||||
ui->pushButton_software->style()->unpolish(ui->pushButton_software);
|
||||
ui->pushButton_software->style()->polish(ui->pushButton_software);
|
||||
|
||||
ui->pushButton_plane->setProperty("state",state2);
|
||||
ui->pushButton_plane->style()->unpolish(ui->pushButton_plane);
|
||||
ui->pushButton_plane->style()->polish(ui->pushButton_plane);
|
||||
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
setPushButtonState(state::Selected,
|
||||
state::unSelected);
|
||||
update();
|
||||
CurrentIndex = 0;
|
||||
emit IndexChanged(CurrentIndex);
|
||||
}
|
||||
|
||||
void Setting::on_pushButton_plane_clicked()
|
||||
{
|
||||
setPushButtonState(state::unSelected,
|
||||
state::Selected);
|
||||
update();
|
||||
CurrentIndex = 1;
|
||||
emit IndexChanged(CurrentIndex);
|
||||
}
|
||||
|
||||
#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)));
|
||||
|
||||
|
||||
setPushButtonState(state::Selected,
|
||||
state::unSelected);
|
||||
|
||||
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::setPushButtonState(uint8_t state1,uint8_t state2)
|
||||
{
|
||||
ui->pushButton_software->setProperty("state",state1);
|
||||
ui->pushButton_software->style()->unpolish(ui->pushButton_software);
|
||||
ui->pushButton_software->style()->polish(ui->pushButton_software);
|
||||
|
||||
ui->pushButton_plane->setProperty("state",state2);
|
||||
ui->pushButton_plane->style()->unpolish(ui->pushButton_plane);
|
||||
ui->pushButton_plane->style()->polish(ui->pushButton_plane);
|
||||
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
setPushButtonState(state::Selected,
|
||||
state::unSelected);
|
||||
update();
|
||||
CurrentIndex = 0;
|
||||
emit IndexChanged(CurrentIndex);
|
||||
}
|
||||
|
||||
void Setting::on_pushButton_plane_clicked()
|
||||
{
|
||||
setPushButtonState(state::unSelected,
|
||||
state::Selected);
|
||||
update();
|
||||
CurrentIndex = 1;
|
||||
emit IndexChanged(CurrentIndex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user