diff --git a/gb.qt4/src/CWindow.cpp b/gb.qt4/src/CWindow.cpp index 356828139..ce29bf133 100644 --- a/gb.qt4/src/CWindow.cpp +++ b/gb.qt4/src/CWindow.cpp @@ -726,19 +726,21 @@ BEGIN_METHOD_VOID(Window_ShowModal) if (check_opened(THIS, TRUE)) return; - - THIS->ret = 0; - - if (!emit_open_event(THIS)) + + if (!THIS->toplevel) { - if (THIS->toplevel) - { - //THIS->widget.flag.visible = true; - WINDOW->showModal(); - //THIS->widget.flag.visible = false; - } + GB.Error("The window is not top-level"); + return; } + THIS->ret = 0; + THIS->modal = TRUE; + + if (!emit_open_event(THIS)) + WINDOW->showModal(); + + THIS->modal = FALSE; + GB.ReturnInteger(THIS->ret); END_METHOD @@ -772,7 +774,7 @@ END_METHOD BEGIN_PROPERTY(Window_Modal) if (THIS->toplevel) - GB.ReturnBoolean(WINDOW->isModal()); + GB.ReturnBoolean(THIS->modal); else GB.ReturnBoolean(false); diff --git a/gb.qt4/src/CWindow.h b/gb.qt4/src/CWindow.h index 0c0ed7c7e..29a645d58 100644 --- a/gb.qt4/src/CWindow.h +++ b/gb.qt4/src/CWindow.h @@ -88,6 +88,7 @@ typedef unsigned noTakeFocus : 1; unsigned moved : 1; unsigned popup : 1; + unsigned modal : 1; } CWINDOW;