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?"
Forum Updated to NodeBB v4.3 + New Features

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 682 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.
  • X Offline
    X Offline
    xmaze
    wrote on 23 Nov 2014, 10:24 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 23 Nov 2014, 17:24 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 23 Nov 2014, 18:48 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

        2/3

        23 Nov 2014, 17:24

        • Login

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