RE: Syncing several QwtPlotPickers
Brought to you by:
rathmann
From: David S. <david_stranz@MassSpec.com> - 2008-06-22 15:38:54
|
Ewald, The implementation of QwtPlotPicker makes it hard to do this without getting into infinite recursion with moved() signals. I would do this: - create a class (QPickerManager) whose job is to listen for the moved(), selected(), etc. signals from plotpickers and to update other plotpickers. This class keeps a list of the linked pickers and has methods to add / remove them from the list. - subclass QwtPlotPicker and create new methods: moveAux(), selectAux(), etc. so that do the same thing as move(), select(), etc. to update the picker state but -do not- emit the moved(), selected(), etc. signals. Copy the code in QwtPicker::move() (qwt_picker.cpp, line 1235) for example, but leave out the "emit moved()" line. This is how you avoid recursion. - when a picker is added to QwtPickerManager, connect the QwtPlotPicker::moved() signal to QwtPickerManager::onMove(), etc. - when a plotpicker fires its moved signal, QwtPickerManager iterates over its list of plotpickers and calls their moveAux() methods. (This will result in the state being updated twice for the picker who fired the original signal - maybe you can check the isActive flag and ignore the update if the flag is set, or maybe you need your own flag in the subclassed QwtPlotPicker you make. I don't know if updating the state twice has side effects - it probably does for methods like append(), so you want to avoid that). I think this will do what you want. Remember that there is only one cursor, so any display in the linked plots will not include the cursor, only the highlighting or whatever other visual display there is for the picker style you have chosen. Let us know if this works. Regards, David _______________________________________________________________ David Stranz, Ph.D. david_stranz@MassSpec.com Sierra Analytics, Inc. 5815 Stoddard Road, Suite 601 Modesto, CA 95356 Tel: (209) 545-8508 http://www.massspec.com _______________________________________________________________ > -----Original Message----- > From: qwt...@li... > [mailto:qwt...@li...] On Behalf > Of Ewald de Wit > Sent: Saturday, June 21, 2008 10:34 AM > To: List for both Qwt users and developers > Subject: Syncing several QwtPlotPickers > > Hi, > > I have several plots, each with their own plotpicker. What I > would like > is that if one plotpicker becomes active and starts moving, the other > plotpickers start to visually move in sync with it. > > Is this possible? > > -- > -- Ewald > > -------------------------------------------------------------- > ----------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > qwt-interest mailing list > qwt...@li... > https://lists.sourceforge.net/lists/listinfo/qwt-interest > |