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, how to close all the Wdigets witout spaming the user "Are you sure?"
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 678 Views
  • 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 Offline
    X Offline
    xmaze
    wrote on last edited by
    #1

    @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
    0
    • A Offline
      A Offline
      archqt
      wrote on last edited by
      #2

      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
      0
      • X Offline
        X Offline
        xmaze
        wrote on last edited by
        #3

        [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
        0

        • Login

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