My ultimate goal is to have application controlling bluetooth equipped device - amateur radio.
I have working standard main window template with tab widget.
I have successfully cloned and have working qtconncetivinty / btsanner example.
I need help putting these together, especially how to add btscanner class to the main class.
Basically how to physically add / modify btscaner application to main application - as a class.
Here is my standard main code
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Here is btsanner main
#include "device.h"
#include <QApplication>
int main(int argc, char *argv[])
{
DeviceDiscoveryDialog d;
QObject::connect(&d,
SIGNAL(accepted
()),
&app,
SLOT(quit
()));
d.show();
app.exec();
return 0;
}
#include "device.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
DeviceDiscoveryDialog d;
QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit()));
d.show();
app.exec();
return 0;
}
To copy to clipboard, switch view to plain text mode
Points of misunderstanding
1. what is the purpose of this line ?
QApplication::setAttribute(Qt::AA_EnableHighDpiSca ling);
2. do I have to implement it when btscanner QDilog is added to main -> tab ?
3. I have limited understanding of "connect" - I know how to implement it in simple ui control.
I do understand how most of the btscanner slot/signals works.
4. What is the purpose of this line of code AND how to implement it - in main window or tab ?
QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit()));
My guess it allows to process "quit" button and quits entire btscanner application.
I be happy to add additional info if needed.
Many thanks for help.
Bookmarks