110 lines
1.9 KiB
C++
110 lines
1.9 KiB
C++
#include "Index1.h"
|
|
#include "ui_Index1.h"
|
|
|
|
Index1::Index1(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::Index1)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
//load qss
|
|
QFile file(":/qss/Setting.qss");
|
|
file.open(QFile::ReadOnly);
|
|
QTextStream filetext(&file);
|
|
QString stylesheet = filetext.readAll();
|
|
this->setStyleSheet(stylesheet);
|
|
file.close();
|
|
|
|
|
|
paramInspect = new ParameterInspector(this);
|
|
|
|
|
|
//qRegisterMetaType<uint8_t>("uint8_t");
|
|
//qRegisterMetaType<uint16_t>("uint16_t");
|
|
//qRegisterMetaType<uint32_t>("uint32_t");
|
|
|
|
|
|
//开启线程之后signal失效
|
|
/*
|
|
connect(paramInspect,SIGNAL(ReadCmd(uint8_t,uint8_t,uint8_t)),
|
|
this,SLOT(ReadCmd(uint8_t,uint8_t,uint8_t)),Qt::DirectConnection);//多线程连接方式
|
|
|
|
connect(paramInspect,SIGNAL(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),
|
|
this,SLOT(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),Qt::DirectConnection);
|
|
*/
|
|
|
|
|
|
|
|
connect(this,SIGNAL(IndexChanged(int)),
|
|
this,SLOT(onTabIndexChanged(int)));
|
|
|
|
emit IndexChanged(0);
|
|
}
|
|
|
|
Index1::~Index1()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void Index1::resizeEvent(QResizeEvent *event)
|
|
{
|
|
Q_UNUSED(event)
|
|
|
|
if(paramInspect)
|
|
{
|
|
paramInspect->setGeometry(ui->frame->geometry());
|
|
}
|
|
|
|
if(widget)
|
|
{
|
|
widget->setGeometry(ui->frame->geometry());
|
|
}
|
|
|
|
update();
|
|
}
|
|
|
|
|
|
void Index1::onTabIndexChanged(const int &index)//界面选择管理
|
|
{
|
|
//参数设置
|
|
if(index == 0)
|
|
{
|
|
if(paramInspect)
|
|
paramInspect->show();
|
|
}
|
|
else if(index == 1)
|
|
{
|
|
if(widget)
|
|
widget->hide();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void Index1::on_pushButton_Parameters_clicked()
|
|
{
|
|
emit IndexChanged(0);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Index1::setInstallWidget(QWidget *w)
|
|
{
|
|
|
|
widget = w;
|
|
widget->setParent(this);
|
|
|
|
if(widget)
|
|
{
|
|
widget->setGeometry(0,0,ui->frame->width(),ui->frame->height());
|
|
widget->show();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|