添加伺服系统
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user