Discussion:
[mitk-users] Mitk Layout to Big3D at plugin start.
Noll, Matthias
2017-05-23 08:56:05 UTC
Permalink
Hi all,

I like to start my plugin with only the 3D render window active. In an older version of MITK it was possible through the StdMultiWidget by simply calling the function changeLayoutToBig3D() e.g. in the plugins' CreateQtPartControl() function.

How can I achieve this now? There are no functions in the IRenderWindowPart to do this.

In the mailing list, Sasha suggested in 2015 to add the plugin dependency to org.mitk.gui.qt.stdmultiwidgeteditor and dynamic_cast the interface. I don't get what interface I need to cast to which class...

This all seems a bit complicated to achieve such a tiny little change. If the user can do it by clicking the QWindowRenderMenu buttons, why can't we do it easily from code. I don't think only having one view active on plugin start is such an uncommon use case.

Anyway, any help would be appreciated.

Best regards,
Matthias
Noll, Matthias
2017-05-24 13:40:44 UTC
Permalink
Hi Stefan,

I managed to change the layout with the following code using your casting approach.

mitk::IRenderWindowPart* render_winow_part = GetRenderWindowPart();
auto editor = dynamic_cast<QmitkStdMultiWidgetEditor*>(render_winow_part);
if (editor != nullptr)
{
auto widget = editor->GetStdMultiWidget();
widget->changeLayoutToBig3D();
}

However, this seems to beak the layout toggle button of the QmitkRenderWindowMenu. I would have expected for the layout to change back to default when I press the button. Instead, the view stays the same each time I click the button. The button icon however switches back to the default icon with the four planes and the printout to the console always states "changing layout to big 3D ...".

Any ideas how this breaks the button functionality and how to fix this?

Thanks,
Matthias

PS:
From: Dinkelacker, Stefan [mailto:***@dkfz-heidelberg.de]
Sent: Mittwoch, 24. Mai 2017 10:33
To: Noll, Matthias <***@igd.fraunhofer.de>; mitk-***@lists.sourceforge.net
Subject: RE: Mitk Layout to Big3D at plugin start.

Hi Matthias,

We increased the decoupling between plugins and editors as not everyone is using the StdMultiWidgetEditor, and having hard dependencies here is very troublesome for these kinds of scenarios. I guess you can cast to [1], as it is the only public class of the plugin and it derives from ILinkedRenderWindowPart. So try to cast your IRenderWindowPart to this one.

Best,
Stefan

[1] https://github.com/MITK/MITK/blob/master/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.h

From: Noll, Matthias [mailto:***@igd.fraunhofer.de]
Sent: Dienstag, 23. Mai 2017 10:56
To: mitk-***@lists.sourceforge.net<mailto:mitk-***@lists.sourceforge.net>
Subject: [mitk-users] Mitk Layout to Big3D at plugin start.

Hi all,

I like to start my plugin with only the 3D render window active. In an older version of MITK it was possible through the StdMultiWidget by simply calling the function changeLayoutToBig3D() e.g. in the plugins' CreateQtPartControl() function.

How can I achieve this now? There are no functions in the IRenderWindowPart to do this.

In the mailing list, Sasha suggested in 2015 to add the plugin dependency to org.mitk.gui.qt.stdmultiwidgeteditor and dynamic_cast the interface. I don't get what interface I need to cast to which class...

This all seems a bit complicated to achieve such a tiny little change. If the user can do it by clicking the QWindowRenderMenu buttons, why can't we do it easily from code. I don't think only having one view active on plugin start is such an uncommon use case.

Anyway, any help would be appreciated.

Best regards,
Matthias
Dinkelacker, Stefan
2017-05-24 14:05:55 UTC
Permalink
Hi Matthias,

You didn't break this button. When you click on Big3D and then click on the icon you mentioned, you will experience the same behavior. This is because the button changes between single window view and the set layout, which is in your case the same. You want to click on the tool icon instead and change the layout back to something with multiple windows.

Best,
Stefan

From: Noll, Matthias [mailto:***@igd.fraunhofer.de]
Sent: Mittwoch, 24. Mai 2017 15:41
To: Dinkelacker, Stefan; mitk-***@lists.sourceforge.net
Subject: RE: Mitk Layout to Big3D at plugin start.

Hi Stefan,

I managed to change the layout with the following code using your casting approach.

mitk::IRenderWindowPart* render_winow_part = GetRenderWindowPart();
auto editor = dynamic_cast<QmitkStdMultiWidgetEditor*>(render_winow_part);
if (editor != nullptr)
{
auto widget = editor->GetStdMultiWidget();
widget->changeLayoutToBig3D();
}

However, this seems to beak the layout toggle button of the QmitkRenderWindowMenu. I would have expected for the layout to change back to default when I press the button. Instead, the view stays the same each time I click the button. The button icon however switches back to the default icon with the four planes and the printout to the console always states "changing layout to big 3D ...".

Any ideas how this breaks the button functionality and how to fix this?

Thanks,
Matthias

PS:
From: Dinkelacker, Stefan [mailto:***@dkfz-heidelberg.de]
Sent: Mittwoch, 24. Mai 2017 10:33
To: Noll, Matthias <***@igd.fraunhofer.de<mailto:***@igd.fraunhofer.de>>; mitk-***@lists.sourceforge.net<mailto:mitk-***@lists.sourceforge.net>
Subject: RE: Mitk Layout to Big3D at plugin start.

Hi Matthias,

We increased the decoupling between plugins and editors as not everyone is using the StdMultiWidgetEditor, and having hard dependencies here is very troublesome for these kinds of scenarios. I guess you can cast to [1], as it is the only public class of the plugin and it derives from ILinkedRenderWindowPart. So try to cast your IRenderWindowPart to this one.

Best,
Stefan

[1] https://github.com/MITK/MITK/blob/master/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.h

From: Noll, Matthias [mailto:***@igd.fraunhofer.de]
Sent: Dienstag, 23. Mai 2017 10:56
To: mitk-***@lists.sourceforge.net<mailto:mitk-***@lists.sourceforge.net>
Subject: [mitk-users] Mitk Layout to Big3D at plugin start.

Hi all,

I like to start my plugin with only the 3D render window active. In an older version of MITK it was possible through the StdMultiWidget by simply calling the function changeLayoutToBig3D() e.g. in the plugins' CreateQtPartControl() function.

How can I achieve this now? There are no functions in the IRenderWindowPart to do this.

In the mailing list, Sasha suggested in 2015 to add the plugin dependency to org.mitk.gui.qt.stdmultiwidgeteditor and dynamic_cast the interface. I don't get what interface I need to cast to which class...

This all seems a bit complicated to achieve such a tiny little change. If the user can do it by clicking the QWindowRenderMenu buttons, why can't we do it easily from code. I don't think only having one view active on plugin start is such an uncommon use case.

Anyway, any help would be appreciated.

Best regards,
Matthias

Loading...