Results 1 to 6 of 6

Thread: QwtPlotMagnifier widgetKeyPressEvent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Posts
    26
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPlotMagnifier widgetKeyPressEvent

    Do I need to do something to enable QwtPlotMagnifier::widgetKeyPressEvent to work?

    Im trying to zoom in with the mouse wheel in only x or y if the x or y key is pressed. Nothing happens with the code below, otherwise the QwtPlotMagnifier seems to working well.


    Qt Code:
    1. class Zoom: public QwtPlotMagnifier
    2. {
    3. public:
    4. Zoom(QwtPlotCanvas *canvas): QwtPlotMagnifier(canvas)
    5. {
    6. }
    7.  
    8. virtual void Zoom::widgetKeyPressEvent (QKeyEvent *ke)
    9. {
    10. if (ke->key() == Qt::Key_X)
    11. {
    12. QwtPlotMagnifier::setAxisEnabled(QwtPlot::yLeft, false);
    13. }
    14. else if (ke->key() == Qt::Key_Y)
    15. {
    16. QwtPlotMagnifier::setAxisEnabled(QwtPlot::xBottom, false);
    17. }
    18. }
    19. virtual void Zoom::widgetKeyReleaseEvent(QKeyEvent *ke)
    20. {
    21. if (ke->key() == Qt::Key_X)
    22. {
    23. QwtPlotMagnifier::setAxisEnabled(QwtPlot::yLeft, true);
    24. }
    25. else if (ke->key() == Qt::Key_Y)
    26. {
    27. QwtPlotMagnifier::setAxisEnabled(QwtPlot::xBottom, true);
    28. }
    29. }
    30. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by robertson1; 4th June 2010 at 00:09. Reason: code formatting

Similar Threads

  1. QwtPlotMagnifier initial zoom
    By jomarin in forum Qwt
    Replies: 6
    Last Post: 6th May 2010, 08:29
  2. Map QwtPlotMagnifier to a button
    By volatile_ah in forum Qwt
    Replies: 1
    Last Post: 28th January 2010, 09:51
  3. Replies: 3
    Last Post: 25th August 2009, 22:35
  4. Replies: 1
    Last Post: 5th March 2009, 05:52
  5. Problem with the QwtPlotMagnifier
    By seguprasad in forum Qwt
    Replies: 8
    Last Post: 6th December 2007, 11:11

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.