Files
gcs-nf/App/ToolsUI/tools_Index0/tools_Index0.cpp
T

101 lines
1.9 KiB
C++
Raw Normal View History

2020-10-24 11:21:24 +08:00
#include "tools_Index0.h"
#include "ui_tools_Index0.h"
Tools_Index0::Tools_Index0(QWidget *parent) :
QWidget(parent),
ui(new Ui::Tools_Index0)
{
ui->setupUi(this);
2020-10-07 19:50:45 +08:00
m_parent = parent;
setWindowTitle(tr("MavlinkInspector"));
//load qss
2020-06-10 20:04:56 +08:00
QFile file(":/qss/ToolsUI.qss");
file.open(QFile::ReadOnly);
QTextStream filetext(&file);
QString stylesheet = filetext.readAll();
this->setStyleSheet(stylesheet);
file.close();
2020-06-11 17:32:58 +08:00
mavlinkinspector = new MAVLinkInspector("mavlink inspector",nullptr,nullptr);
mavlinkinspector->setParent(this);
mavlinkinspector->show();
2020-08-01 10:53:17 +08:00
//scope = new Scope(this);
//scope->setGeometry(ui->frame->geometry());
//scope->show();
2020-06-11 17:32:58 +08:00
}
Tools_Index0::~Tools_Index0()
{
delete ui;
}
2020-10-07 19:50:45 +08:00
void Tools_Index0::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void Tools_Index0::contextMenuEvent(QContextMenuEvent *event)
{
/*
2020-10-07 19:50:45 +08:00
QMenu *menu = new QMenu(this);
QAction *pAction = new QAction("float",this);
connect(pAction,SIGNAL(triggered(bool)),
this,SLOT(setFloat()));
menu->addAction(pAction);
menu->move(cursor().pos());
menu->show();
*/
2020-10-07 19:50:45 +08:00
}
void Tools_Index0::setFloat(void)
{
if(this->parent())
{
this->setParent(nullptr);
2020-12-06 23:06:17 +08:00
this->move(50,50);
2020-10-07 19:50:45 +08:00
this->resize(800,480);
2020-10-24 11:21:24 +08:00
this->show();
2020-10-07 19:50:45 +08:00
}
else
{
this->setParent(m_parent);
this->setGeometry(m_parent->geometry());
this->move(0,0);
2020-10-24 11:21:24 +08:00
this->hide();
2020-10-07 19:50:45 +08:00
}
}
void Tools_Index0::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event)
2020-06-11 17:32:58 +08:00
if(mavlinkinspector)
{
2020-06-11 17:32:58 +08:00
mavlinkinspector->setGeometry(0,0,ui->frame->width(),ui->frame->height());
}
update();
}
void Tools_Index0::setInstallWidget(QWidget *w)
{
Inspect = w;
Inspect->setParent(this);
if(Inspect)
{
Inspect->setGeometry(0,0,ui->frame->width(),ui->frame->height());
Inspect->show();
}
}