Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CloseEvent problem for early closures and a lenghthy constructor
Forum Updated to NodeBB v4.3 + New Features

CloseEvent problem for early closures and a lenghthy constructor

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jh224
    wrote on last edited by
    #1

    My constructor does a lot initializations and take a little bit before it completes. The problem occurs when the users decides to close out of the application before it has fully initialized and the MainWindow constructor has not fully ran. The close event is successful in stopping all the initializations. If the user waits until the constructor has ran, everything is good. However for the early closings, I can't seem to time it out or wait to accept the event. After stopping the initializations, the constructor finishes in less than a second.

    I've tried:

    @void MainWindow::closeEvent(QCloseEvent *event)
    {

    // Stop all Initializations
       stopIniters();  // successfull....after running this, the constructor finishes very 
                           // quickly... however, I can't figure how to time the
                           // close event accept
    
       while(constructorHasRan == false)  ///trying to wait for constructor to run
           { qApp->processEvents();}  ///it stays in this loop  
    
        event->accept();
    

    }
    @

    1 Reply Last reply
    0
    • B Offline
      B Offline
      butterface
      wrote on last edited by
      #2

      What exactly is the problem with that? What are you doing in your constructor? Did you try to block the signals until it is finished?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved