Results 1 to 3 of 3

Thread: Panner Zoomer Scroll synchronization

  1. #1
    Join Date
    Jan 2010
    Location
    Ankara - TURKEY
    Posts
    30
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Panner Zoomer Scroll synchronization

    Hi All,

    I have a plot plugin and in this plot I have used panner zoomer and scroll too for kind of axes scale operation.
    My question is what is the best way or is there any simple way to snchronize these kind of gadgets to control my scale ranges. Which signal do I follow for all gadgets to work in collaborative way?

    Thanks in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Panner Zoomer Scroll synchronization

    Well this is one of the parts where the design of the Qwt classes is week. The main problem is, that there are local zoom stacks ( local for each zoomer object ) but not a general navigation stack recording the history of all navigation operations.

    Probably the best you can do is to modify the zoom stack ( zoomStack/setZoomStack ) manually in a slot connected to the panned signal of your panner.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    umituzun84 (1st July 2010)

  4. #3
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Panner Zoomer Scroll synchronization

    The QwtPlotPanner class has a "panned" signal and a "moveCanvas" slot, so you can synchronize scrolling on two panners as follows:
    Qt Code:
    1. QObject::connect(panner1,SIGNAL(panned(int,int)),panner2,SLOT(moveCanvas(int,int)));
    2. QObject::connect(panner2,SIGNAL(panned(int,int)),panner1,SLOT(moveCanvas(int,int)));
    To copy to clipboard, switch view to plain text mode 

    You could create a QwtLinkedPlotMagnifier class that derives from QwtPlotMagnifier to have similar slots and signals, and emit a resize_event() signal every time resize() is called:
    Qt Code:
    1. class QwtLinkedPlotMagnifier : public QwtPlotMagnifier
    2. {
    3. Q_OBJECT
    4. public:
    5. explicit QwtLinkedPlotMagnifier(QwtPlotCanvas *canvas);
    6.  
    7. protected:
    8. virtual void rescale(double factor);
    9.  
    10. signals:
    11. void rescale_event(double factor);
    12.  
    13. public slots:
    14. void do_rescale(double factor);
    15.  
    16. };
    17.  
    18. QwtLinkedPlotMagnifier::QwtLinkedPlotMagnifier(QwtPlotCanvas *canvas) :
    19. {
    20. }
    21.  
    22. void QwtLinkedPlotMagnifier::rescale(double factor){
    23. QwtPlotMagnifier::rescale(factor);
    24. emit rescale_event(factor);
    25. }
    26.  
    27. void QwtLinkedPlotMagnifier::do_rescale(double factor){
    28. QwtPlotMagnifier::rescale(factor);
    29. }
    To copy to clipboard, switch view to plain text mode 

    Not sure about getting the qwt zoomer class to do what you want, though.

Similar Threads

  1. QDial disabling key scroll and mouse wheel scroll
    By ldg20 in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2010, 23:05
  2. Problem with Zoomer
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 10th March 2010, 12:35
  3. zoomer in spectrogram example
    By rambo83 in forum Qwt
    Replies: 0
    Last Post: 1st December 2009, 09:06
  4. how could the value in every grid after zoomer?
    By matt_atlantis in forum Qwt
    Replies: 1
    Last Post: 29th July 2009, 01:26
  5. Replies: 6
    Last Post: 14th April 2006, 05:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.