添加伺服系统

This commit is contained in:
hm
2020-10-06 17:11:59 +08:00
parent 16579855c0
commit 6da5821dcb
12 changed files with 439 additions and 10 deletions
+52 -5
View File
@@ -7,6 +7,15 @@ PowerSystem::PowerSystem(QWidget *parent) :
{
ui->setupUi(this);
par = parent;
//setContextMenuPolicy(Qt::ActionsContextMenu);
//ui->checkBox->setCheckable(true);
//ui->checkBox->setChecked(true);
//ui->checkBox->setCheckable(false);
@@ -61,11 +70,49 @@ PowerSystem::~PowerSystem()
}
void PowerSystem::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::RightButton)
{
qDebug() << event;
}
}
void PowerSystem::contextMenuEvent(QContextMenuEvent *event)
{
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();
}
void PowerSystem::setFloat(void)
{
if(this->parent())
{
this->setParent(nullptr);
}
else
{
this->setParent(par);
this->move(0,0);
}
this->show();
}