Hi Sascha,

thanks for the suggestions.

On 12/02/2014 12:34, Sascha Zelzer wrote:
> Hi Johannes,
> 
> If you can modify your applications WorkbenchAdvisor and/or 
> WorkbenchWindowAdvisor classes, you can overwrite
> 
> bool berry::WorkbenchAdvisor::PreShutdown() [1]

I tried this one.
But returning false crashes the application: the main workbench window
is destroyed anyway and then some signals are being delivered,
triggering a null-function-pointer-call.

I stepped through the code a bit, all the way down to
berryWindow.cpp:Window::HandleShellCloseEvent() which is the first
caller that ignores the return value.
Further down the stack there is
berryQtMainWindowControl.cpp:QtMainWindowControl::closeEvent(QCloseEvent*)
which seems to accept() the event, no matter what the advisor's return
value was.
https://qt-project.org/doc/qt-4.8/qcloseevent.html says one should
ignore() QCloseEvent if the widget/window should not be closed.



Johannes

> bool berry::WorkbenchWindowAdvisor::PreWindowShellClose() [2]
> 
> and also veto the closing of a window or shutdown of the workbench.
> 
> If you don't want to or cannot modify the advisor classes, then there 
> are other means.
> 
> Best,
> Sascha
> 
> 
> [1] 
> http://docs.mitk.org/2013.12/classberry_1_1WorkbenchAdvisor.html#a0b79cfa9ec184cc2ad99223434bcad1f
> [2] 
> http://docs.mitk.org/2013.12/classberry_1_1WorkbenchWindowAdvisor.html#abe337b4bdc49d7057c1e225f1fc283ec
> 
> 
> On 02/07/2014 03:35 PM, Johannes Totz wrote:
>> Hi,
>>
>> How would I create a confirmation dialog box that pops up when the user
>> tries to close the main (mitk-)application window? Something like "do
>> you really want to exit? Yes No"
>>
>> I got lost somewhere between blueberry, ctk and mitk while trying
>> figuring out how the main window is created... I would normally go via
>> QWidget::closeEvent(QCloseEvent*).
>>
>>
>> Thanks,
>>
>> Johannes



------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to