Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    CloseEvent problem, how to close all the Wdigets witout spaming the user "Are you sure?"

    General and Desktop
    2
    3
    599
    Loading More Posts
    • 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.
    • X
      xmaze last edited by

      @void MainWindow::closeEvent ( QCloseEvent * event )
      {
      event->ignore();
      if (QMessageBox::Yes == QMessageBox::question(this, "Close Confirmation?",
      "Are you sure you want to exit?",
      QMessageBox::Yes|QMessageBox::No))
      {
      event->accept();
      sendform->close();
      }
      }

      void SendForm::closeEvent ( QCloseEvent * event )
      {
      event->ignore();
      if (QMessageBox::Yes == QMessageBox::question(this, "Close Confirmation?",
      "Are you sure you want to exit?",
      QMessageBox::Yes|QMessageBox::No))
      {
      event->accept();
      }
      }

      @

      Hi, i have the closeEvent function to close and the second widget of my App, the problem is that the program Spamming the user with the QMessageBox. How can i find who is the sender to disable the Qmesagebox when a widget calls the close() function and not the User ?

      1 Reply Last reply Reply Quote 0
      • A
        archqt last edited by

        Hi,
        Why not using a variable which stores a true/false value to say if you have to ask the user for the question again ?
        Sincerely

        1 Reply Last reply Reply Quote 0
        • X
          xmaze last edited by

          [quote author="archqt" date="1416763454"]Hi,
          Why not using a variable which stores a true/false value to say if you have to ask the user for the question again ?
          Sincerely[/quote]

          i am not sure if it's easy between two classes to make this without to use a QT way/function! how to recognise if the user or the Qwidget send the command ?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post