Hi again, I talked to Sascha Zelzer, who is our framework guru to evaluate different strategies for synchronizing QmitkDataStorageComboBoxes. As long as your views are in the same plugin, you can just use the Qt connect() mechanism to synchronize the different combo boxes. The tricky part here is to access a view from another view. However, this is somehow possible by GetViewSite()->...->... to get the right pointer via the view ID and then downcast it appropriately.
Another possibility might be to use the Selection Services directly (this way you still would have the possibility to select your data in the data manager). [1] Only if the second option doesn't work for you for some reasons, you could use the CTK Event Bus to communicate between plugins and views. Best, Stefan [1] http://docs.mitk.org/nightly-qt4/IntroductionSelectionService.html -----Ursprüngliche Nachricht----- Von: Rostislav Khlebnikov [mailto:[email protected]] Gesendet: Dienstag, 25. März 2014 17:46 An: [email protected] Betreff: Re: [mitk-users] OnSelectionChanged when DataManager is not active Hello Stefan, thank you for your quick answer! I actually had the QmitkDataStorageComboBoxes at one point during the development and it worked pretty well. The main concern with using the combo boxes is that I would like to have some kind of central synchronization point, because I have several views which depend on the currently selected node and I would like to keep them consistent. If I only use the comboboxes then the user needs to change the selected node in every view manually which is really not what I want to have them do. I thought that perhaps DataManager's selection is the way to have them synced. What do you think would be the better way to have this kind of sync point? Pehaps I should create some kind of service that would keep track of the nodes in question? Thanks, Rostislav. On 25/03/2014 16:15, Kislinskiy, Stefan wrote: > Hi, > > this is not a direct solution but based on my own experiences I strongly > recommend not to integrate the Data Manager into a view's logic if possible. > There are countless pitfalls and surprising state changes you have to be > aware of and you can't control. Even worse, due to changes in the code base, > the logic of other plugins or the Data Manager changes over time and you > would have to adapt without knowing that you have to. The segmentation view > is unfortunately a negative example as many (!) lines of code in its > implementation do nothing but to try to act proberly based on selections. > This really caused a lot of bugs in the past and I'm sure there are still a > few minor ones left. > > A more simple and cleaner solution would be to *only* use > QmitkDataStorageComboBoxes in your view for data selection and to listen to > their OnSelectionChanged signal. You can graft a predicate to restrict the > available combo box items to certain data nodes, e.g., segmentation images > which are not a helper object. The QmitkDataStorageComboBox is aware of Data > Manager changes, e.g. when nodes are removed and so on. > > Best, > Stefan > ________________________________________ > Von: Rostislav Khlebnikov [[email protected]] > Gesendet: Dienstag, 25. März 2014 16:34 > An: [email protected] > Betreff: [mitk-users] OnSelectionChanged when DataManager is not > active > > Hello, > > I have a small problem with selecting the nodes from within the > application. I create data node similar to segmentation view and I can > instruct the datamanager to select the newly created node by calling > SetDataManagerSelection method. > However, I have some other views depending on the current selection > and the OnSelectionChanged is not called on any of views until the > Data Manager view is focused. I have also tried to use > FireNodeSelected method, but the results are the same. > It seems to me that this bug > http://bugs.mitk.org/show_bug.cgi?id=16081 > refers to exactly the same behaviour. > > So, the question is if there is a way to force the call of > OnSelectionChanged() when the Data Manager view is not active. Or > perhaps there is some workaround for this? > > All best, > Rostislav. > > > ---------------------------------------------------------------------- > -------- Learn Graph Databases - Download FREE O'Reilly Book "Graph > Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, this > first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > mitk-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
