Results 1 to 4 of 4

Thread: zooming when mouse hovers axis-label

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: zooming when mouse hovers axis-label

    1. If my mouse is in the canvas, only the Y-axis should be zoomed.
    - I think that shouldn't be a problem.
    For the panner use QwtPlotPanner::setAxisEnabled( bool ).
    For the zoomer you need to have one x axis, but when you use only one of the simple assign the other one: f.e zoomer->setAxis( QwtPlot::xTop, ... );
    2. If my mouse is over the X-axis-label (time-label), only the X-axis should be zoomed.
    - Here's my problem: How can I detect, that the mouse is hovering the X-axis-label?
    Install an event filter for the axis widget: plot->axisWidget( QwtPlot::xBottom )->installEventFilter( ... );

    • plot->axisWidget( QwtPlot::xBottom )->scaleDiv() returns the values of the ticks ( labels are on the major ticks )
    • plot->axisWidget( QwtPlot::xBottom )->scaleDraw()->labelRect() calculates the bounding rectangle of a labels.
    • plot->axisWidget( QwtPlot::xBottom )->scaleDraw()->scaleMap() translates widget coordinates ( f.e mouse clicks ) into plot coordinates and v.v.

    HTH,
    Uwe

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

    Andreas (15th December 2011)

Similar Threads

  1. Replies: 6
    Last Post: 4th November 2011, 07:51
  2. Qt Designer How to make Button work with webwiev and a Label shows Mouse Position?
    By heavy.is.happy in forum Qt Tools
    Replies: 3
    Last Post: 8th July 2011, 20:26
  3. What determines color of text shown as axis label?
    By DrunkenUFOPilot in forum Qwt
    Replies: 1
    Last Post: 24th March 2011, 19:55
  4. Replies: 2
    Last Post: 28th December 2010, 12:41
  5. how to get the position of mouse click on a label
    By qt_user in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2010, 10:14

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
  •  
Qt is a trademark of The Qt Company.