Results 1 to 2 of 2

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

  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,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    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, 08:40
  2. Replies: 2
    Last Post: 21st March 2014, 02:44
  3. qwt log scale Y and linear scale X
    By Annihilator in forum Qwt
    Replies: 1
    Last Post: 31st December 2012, 10:01
  4. Non-typical and Non-linear wizard
    By kornicameister in forum Qt Programming
    Replies: 4
    Last Post: 30th December 2010, 15:26
  5. How to determine if my app is active...
    By Ben.Hines in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 16: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.