Excuse my c++ ignorance.
I am trying to attach the QCoreApplication::aboutToQuit() signal to my save function so I can save some data after the user closes the app on BB10 OS. My QCloseEvent doesn't get called on BB10 when the user swipes up and closes the app so I am trying this approach as suggested in the docs for BB10.
According to the docs for BB10 I have 3 seconds after the signal aboutToQuit() is emited which should be plenty of time for QSettings to save my data.
I put this line in my main.cpp
QObject::connect(&a,
SIGNAL(aboutToQuit
()),
&w,
SLOT(save
()));
QObject::connect(&a, SIGNAL(aboutToQuit()), &w, SLOT(save()));
To copy to clipboard, switch view to plain text mode
Here is my entire main.cpp for referance:
#include <QtGui/QApplication>
//#include <QtGui/QGuiApplication>
#include "biologger.h"
//#include <bb/Application>
int main(int argc, char *argv[])
{
a.setOrganizationName("HeronBoy");
a.setOrganizationDomain("theHerons.ca");
a.setApplicationName("Bio Logger");
bioLogger w;
w.showMaximized();
QObject::connect(&a,
SIGNAL(aboutToQuit
()),
&w,
SLOT(save
()));
return a.exec();
}
#include <QtGui/QApplication>
//#include <QtGui/QGuiApplication>
#include "biologger.h"
//#include <bb/Application>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setOrganizationName("HeronBoy");
a.setOrganizationDomain("theHerons.ca");
a.setApplicationName("Bio Logger");
bioLogger w;
w.showMaximized();
QObject::connect(&a, SIGNAL(aboutToQuit()), &w, SLOT(save()));
return a.exec();
}
To copy to clipboard, switch view to plain text mode
But my save function is never called?
The way I understand it the signal should be accessible from any public slots in the application and I have my save function declared as a pubic slot
public slots:
void save();
public slots:
void save();
To copy to clipboard, switch view to plain text mode
.
Any help or insight on how to troubleshoot this would be appreciated.
Cheers,
Jon
Bookmarks