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. QCloseEvent in more than one window
Forum Updated to NodeBB v4.3 + New Features

QCloseEvent in more than one window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 858 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.
  • V Offline
    V Offline
    vitorino
    wrote on last edited by
    #1

    Hi I have used the QCloseEvent in one window and it worked very well, as soon as I set it on a second one the close event from both stoped working. The first one just worked again when I deleted the second one. Can I not use more than one QCloseEvent?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please post the code where you have the problem. Without it it's pretty much Crystal Ball Debugging.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vitorino
        wrote on last edited by
        #3

        This is the one which works (when the second one is not writen):

        prompt.h
        @ protected:
        void closeEvent_Prompt (QCloseEvent *event_P);

        public:
        QString CheckStatus;
        @

        prompt.cpp
        @ void DialogPrompt::closeEvent_Prompt (QCloseEvent *event_P)
        {
        if (CheckStatus == "TRUE") {
        event_P->accept();
        } else {
        event_P->ignore();
        }
        }@

        and this is the second one:

        hitt.h
        @ protected:
        void closeEvent_Hitt (QCloseEvent *event_H);

        public:
        QString NewType;
        @

        hitt.cpp
        @ void DialogHitt::closeEvent_Hitt (QCloseEvent *event_H)
        {
        if (NewType == "TRUE") {
        event_H->accept();
        } else {
        event_H->ignore();
        }
        }@

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rondog
          wrote on last edited by
          #4

          I don't see how you can have two closeEvents() in one application (dialog, main_window, widget, other).

          If these are two modeless dialogs (DialogHitt, DialogPrompt) that both run actively all the time maybe the closeEvent() should be part of the parent? You might be able to do something like this without interfering with the event:

          @
          void DialogHitt::closeEvent_Hitt (QCloseEvent *event_H)
          {
          QDialog::closeEvent(event_H);

          emit Something_Hit_Close();
          }
          @

          I guess I don't see what your trying to do.

          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