16,794
社区成员




QBluetoothDeviceDiscoveryAgent *mAgent;
QBluetoothLocalDevice *localDevice;
MainDialog::MainDialog(QWidget *parent) :
QDialog(parent), ui(new Ui::MainDialog), localDevice(new QBluetoothLocalDevice)
{
ui->setupUi(this);
mAgent = new QBluetoothDeviceDiscoveryAgent();
connect(mAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), this, SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
connect(mAgent, SIGNAL(finished()), this, SLOT(deviceFinished()));
}
void MainDialog::on_pushButtonOpenDev_clicked()
{
if (!localDevice->isValid())
{
QMessageBox::information(this, "Open", "not valid");
return;
}
localDevice->powerOn();
mAgent->start();
}