Results 1 to 2 of 2

Thread: Switching Log and Linear scale, determine which is active

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Switching Log and Linear scale, determine which is active

    Beginner question, I want to make button to switch between Log and Linear axis. How to determine which transformation is active without declaring new variable ?
    Qt Code:
    1. void HistPlot::switchLogLin()
    2. {
    3. if(plot->axisScaleDraw(QwtPlot::yLeft)-> ?....== ? )
    4. plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine);
    5. else plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
    6. }
    To copy to clipboard, switch view to plain text mode 

    Thanks

    Martin

  2. #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: Switching Log and Linear scale, determine which is active

    As long as you have not RTTI disabled:

    Qt Code:
    1. if ( dynamic_cast<const QwtLogScaleEngine *>( plot->axisScaleEngine( QwtPlot::yLeft ) ) )
    2. ...
    To copy to clipboard, switch view to plain text mode 
    Uwe

Similar Threads

  1. Replies: 1
    Last Post: 15th July 2014, 09:40
  2. Replies: 2
    Last Post: 21st March 2014, 03:44
  3. qwt log scale Y and linear scale X
    By Annihilator in forum Qwt
    Replies: 1
    Last Post: 31st December 2012, 11:01
  4. Non-typical and Non-linear wizard
    By kornicameister in forum Qt Programming
    Replies: 4
    Last Post: 30th December 2010, 16:26
  5. How to determine if my app is active...
    By Ben.Hines in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 17:02

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.