QCloseEvent in more than one window
-
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?
-
Hi,
Please post the code where you have the problem. Without it it's pretty much Crystal Ball Debugging.
-
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();
}
}@ -
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.