Results 1 to 5 of 5

Thread: Problem with aboutToQuit().

  1. #1
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with aboutToQuit().

    I have a problem with having an aboutToQuit() function.

    Qt Code:
    1. // THIS IS INT MAIN()'s end.
    2. int end = Qapp.exec();
    3. QObject::connect(&Qapp, SIGNAL(aboutToQuit()), qwCoreWindow, SLOT(almostQutting()));
    4. return end;
    5. }
    6. // declared thru CoreWindow as public slot
    7. void CoreWindow::almostQuitting(){
    8. QMessageBox QMB2(QMessageBox::NoIcon, "Help", "Saving to Registry "+
    9. QString("size h: %1").arg(size().height())+QString("pos.x: %1").arg((long)pos().x()), QMessageBox::Ok);
    10. switch (QMB2.exec()) {
    11. case QMessageBox::Ok:
    12. break;
    13. default:
    14. break;
    15. }
    16. CP.SaveDefaultSettings(size(), pos());
    17. }
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by jacek; 26th March 2007 at 20:12. Reason: wrapped too long line

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with aboutToQuit().

    Quote Originally Posted by VireX View Post
    int end = Qapp.exec();
    QObject::connect(&Qapp, SIGNAL(aboutToQuit()), qwCoreWindow, SLOT(almostQutting()));
    Try:
    Qt Code:
    1. QObject::connect(&Qapp, SIGNAL(aboutToQuit()), qwCoreWindow, SLOT(almostQutting()));
    2. int end = Qapp.exec();
    To copy to clipboard, switch view to plain text mode 
    As the aboutToQuit() is emitted before QCoreApplication::exec() returns.

  3. #3
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with aboutToQuit().

    It didn't work that way before so that's why I posted it that way.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with aboutToQuit().

    Shouldn't it be SLOT(almostQuitting())?
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    VireX (26th March 2007)

  6. #5
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with aboutToQuit().

    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 ^^.
    Last edited by VireX; 26th March 2007 at 22:41.

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.