I pushed the changes to my GitHub fork. https://github.com/espakm/MITK-ProjectTemplate
If you look into the commits, you will see that I had a custom version of the file menu actions as well, those I removed with the last commit because probably it is not useful for others. If you need them, just check out the last but one commit. I added only one thing, the file save dialog opens the last directory used in the file open dialog in default. Best, Miklos On Fri, Aug 26, 2011 at 11:02 AM, Clarkson, Matt <[email protected]> wrote: > Hi Sascha, > thanks. I went for the subclassing option. So, I > subclassed QmitkExtWorkbenchWindowAdvisor and wrote a PostWindowCreate > method to connect back to my own slot in that class, which meant my subclass > also extends QObject. It seems to trigger the method, so I think it should > be ok. > Thanks > Matt > PS. Also raised bug 9182. > > QmitkMyAppWorkbenchWindowAdvisor::QmitkMyAppWorkbenchWindowAdvisor( > berry::WorkbenchAdvisor* wbAdvisor, > berry::IWorkbenchWindowConfigurer::Pointer configurer) > : QmitkExtWorkbenchWindowAdvisor(wbAdvisor, configurer) > { > } > void QmitkMyAppWorkbenchWindowAdvisor::PostWindowCreate() > { > QmitkExtWorkbenchWindowAdvisor::PostWindowCreate(); > // All this to call our own About dialog box. > // 1. Get hold of menu bar > berry::IWorkbenchWindow::Pointer window = > this->GetWindowConfigurer()->GetWindow(); > QMainWindow* mainWindow = > static_cast<QMainWindow*> (window->GetShell()->GetControl()); > QMenuBar* menuBar = mainWindow->menuBar(); > QList<QMenu *> allMenus = menuBar->findChildren<QMenu *>(); > for (int i = 0; i < allMenus.count(); i++) > { > QList<QAction*> actionsForMenu = > allMenus.at(i)->findChildren<QAction*>(); > for (int j = 0; j < actionsForMenu.count(); j++) > { > QAction *action = actionsForMenu.at(j); > if (action != NULL && action->text() == "&About") > { > // 2. Disconnect existing slot > action->disconnect(); > // 3. Reconnect slot to our method to call our About Dialog. > QObject::connect(action, SIGNAL(triggered()), this, > SLOT(OnHelpAbout())); > } > } > } > } > void QmitkMyAppWorkbenchWindowAdvisor::OnHelpAbout() > { > std::cerr << "OnHelpAbout::Triggered()" << std::endl; > } > > On 25 Aug 2011, at 19:48, Sascha Zelzer wrote: > > Hi Matt, > > Your are right that the QmitkExtWorkbenchWindowAdvisor contains a lot of > sub-optimal code due to the lack of a generic mechanism for plugins to > contribute menu items. However, even for a mid-term solution, I see only two > possibilities: > > 1.) Create your own QmitkExtWorkbenchWindowAdvisor, either by subclassing or > copying the code, as Miklos already suggested. You don't need a separate > plug-in, just put the code where your berry::IApplication implementation > lives. > > 2.) We could add a method in QmitkExtWorkbenchWindowAdvisor which would > allow you to inject a custom about dialog, or something similar. You would > then just use QmitkExtWorkbenchWindowAdvisor, similar as the > QmitkExtAppWorkbenchAdvisor class in org.mitk.gui.qt.extapplication does. > > On 08/25/2011 06:07 PM, Clarkson, Matt wrote: > > > I also noticed that on a MAC, the About dialog box has no exit button, so I > have to kill the application to get rid of it. > > Could you maybe enter a bug report? > > Thanks, > Sascha > > > > ------------------------------------------------------------------------------ > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > _______________________________________________ > mitk-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mitk-users > > ------------------------------------------------------------------------------ EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
