Results 1 to 2 of 2

Thread: Zooming in but not out

  1. #1
    Join Date
    Sep 2007
    Posts
    29
    Thanks
    8
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Zooming in but not out

    I have i graph in which i can succesfully zoom (left mouse button) but when i want to zoom out (right mouse button) i get a whole new graph plot and my previous graph is gone. Like it replots a graph on top of it.
    This is my code:
    Qt Code:
    1. class GraphPlot(Qwt.QwtPlot):
    2.  
    3. def __init__(self, *args):
    4. Qwt.QwtPlot.__init__(self, *args)
    5. #self.plot = Qwt.QwtPlot(self)
    6.  
    7. # make a QwtPlot widget
    8. self.setTitle("Graph Plot")
    9. #self.__initTracking()
    10. self.__initZooming()
    11. ...
    12. ...
    13. def __initZooming(self):
    14. self.replot()
    15. self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom,
    16. Qwt.QwtPlot.yLeft,
    17. Qwt.QwtPicker.DragSelection,
    18. Qwt.QwtPicker.AlwaysOff,
    19. self.canvas())
    20. self.zoomer.setRubberBandPen(qt.QPen(qt.Qt.black))
    21. self.replot()
    22.  
    23. #end __initZooming
    To copy to clipboard, switch view to plain text mode 

    thanks a lot!

  2. #2
    Join Date
    Sep 2007
    Posts
    29
    Thanks
    8
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Zooming in but not out

    Wohoo i fixed it, never mind!
    dont place it in the class, place it here:

    Qt Code:
    1. def main(args):
    2. app = qt.QApplication(args)
    3. demo = make()
    4. app.setMainWidget(demo)
    5.  
    6. zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom,
    7. Qwt.QwtPlot.yLeft,
    8. Qwt.QwtPicker.DragSelection,
    9. Qwt.QwtPicker.AlwaysOff,
    10. demo.canvas())
    11. zoomer.setRubberBandPen(qt.QPen(qt.Qt.green))
    12. picker = Qwt.QwtPlotPicker(Qwt.QwtPlot.xBottom,
    13. Qwt.QwtPlot.yLeft,
    14. Qwt.QwtPicker.NoSelection,
    15. Qwt.QwtPlotPicker.CrossRubberBand,
    16. Qwt.QwtPicker.AlwaysOn,
    17. demo.canvas())
    18. picker.setTrackerPen(qt.QPen(qt.Qt.red))
    19.  
    20. sys.exit(app.exec_loop())
    21.  
    22. # main()
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Zooming scene Rect(Qt bug?)
    By maverick_pol in forum Qt Programming
    Replies: 31
    Last Post: 30th August 2007, 09:31
  2. Zooming in QGraphicsView
    By JonathanForQT4 in forum Newbie
    Replies: 3
    Last Post: 17th April 2007, 05:50
  3. Replies: 3
    Last Post: 11th March 2007, 13:04
  4. Zooming QCanvas: QCanvasLine problem
    By Pieter from Belgium in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2006, 16:58
  5. Zooming a paricular selected region
    By Kapil in forum Newbie
    Replies: 8
    Last Post: 9th May 2006, 14:41

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.