diff --git a/include/wx/qt/private/winevent.h b/include/wx/qt/private/winevent.h index 5137f6d00e..f29b329e67 100644 --- a/include/wx/qt/private/winevent.h +++ b/include/wx/qt/private/winevent.h @@ -104,7 +104,7 @@ protected: if ( !this->GetHandler()->QtHandleCloseEvent(this, event) ) Widget::closeEvent(event); else - event->accept(); + event->ignore(); } //wxContextMenuEvent diff --git a/src/qt/window.cpp b/src/qt/window.cpp index cabf652879..c67e9606ea 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -1557,12 +1557,17 @@ bool wxWindowQt::QtHandleChangeEvent ( QWidget *handler, QEvent *event ) return false; } +// Returns true if the closing should be vetoed and false if the window should be closed. bool wxWindowQt::QtHandleCloseEvent ( QWidget *handler, QCloseEvent *WXUNUSED( event ) ) { if ( GetHandle() != handler ) return false; - return Close(); + // This is required as Qt will still send out close events when the window is disabled. + if ( !IsEnabled() ) + return true; + + return !Close(); } bool wxWindowQt::QtHandleContextMenuEvent ( QWidget *WXUNUSED( handler ), QContextMenuEvent *event )