PDA

View Full Version : Problem with aboutToQuit().



VireX
26th March 2007, 20:06
I have a problem with having an aboutToQuit() function.



// THIS IS INT MAIN()'s end.
int end = Qapp.exec();
QObject::connect(&Qapp, SIGNAL(aboutToQuit()), qwCoreWindow, SLOT(almostQutting()));
return end;
}
// declared thru CoreWindow as public slot
void CoreWindow::almostQuitting(){
QMessageBox QMB2(QMessageBox::NoIcon, "Help", "Saving to Registry "+
QString("size h: %1").arg(size().height())+QString("pos.x: %1").arg((long)pos().x()), QMessageBox::Ok);
switch (QMB2.exec()) {
case QMessageBox::Ok:
break;
default:
break;
}
CP.SaveDefaultSettings(size(), pos());
}

I added the message box to see what changes. Because it wasn't saving the registry (SaveDefaultSettings).
I wanted to see if it remembered the QSize and QPoint (position) of the main window which is CoreWindow...

Any help is appreciated.

jacek
26th March 2007, 20:14
int end = Qapp.exec();
QObject::connect(&Qapp, SIGNAL(aboutToQuit()), qwCoreWindow, SLOT(almostQutting()));
Try:
QObject::connect(&Qapp, SIGNAL(aboutToQuit()), qwCoreWindow, SLOT(almostQutting()));
int end = Qapp.exec();
As the aboutToQuit() is emitted before QCoreApplication::exec() returns.

VireX
26th March 2007, 20:42
It didn't work that way before so that's why I posted it that way.

jpn
26th March 2007, 20:55
Shouldn't it be SLOT(almostQuitting())?

VireX
26th March 2007, 22:35
LoL....................... you guys need smileys for these kinds of situations. I musta read over everything so many times, but that psychological thing that blocks your mind from reading certain letters messed me up:

Cn yu rd ths sttmnt r nt?

And yep, I guess I should still stay in newbie section ^^.