Adding a QDialog to a QML Application?
So using Qt 5.2 I created a Qt Quick Application project, which comes with qtquick2applicationviewer .h and .cpp, a main.cpp, and QML files.
I want to add a .cpp and .h file to control system notifications based on things that happen in the main QML application. I was following the example here http://doc.qt.digia.com/4.6/desktop-systray.html but that is a QWidget in itself, not a QML view. I thought I could just create a C++ class that extends QDialog that i could call to display system notifications, but it seems it just doesn't work that way?
Here's my current code:
class notifications : public QDialog
#endif // NOTIFICATIONS_H@
quitAction = new QAction("&Quit", this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
trayIconMenu = new QMenu(this);
trayIcon = new QSystemTrayIcon(this);
Now all Qt Creator says is "QWidget: Cannot create a QWidget without QApplication." Does that mean I have to implement my entire QML application as a QApplication in Qt instead?