#include "mydevice.h" #include "ui_mydevice.h" #include "mydevice.h" #include "ui_mydevice.h" mydevice::mydevice(QWidget *parent) : QWidget(parent), ui(new Ui::mydevice) { ui->setupUi(this); floatingbutton= new FloatingButton (this); // 将悬浮球的pressed()信号连接到槽函数onButtonPressed()上 connect(floatingbutton, &FloatingButton::pressed, this, &mydevice::onButtonPressed); } mydevice::~mydevice() { delete ui; delete floatingbutton; } void mydevice::onButtonPressed() { this->close(); }