Results 1 to 5 of 5

Thread: QwtThermo scale update

  1. #1
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtThermo scale update

    I need a QwtThermo with a scale with higher resolution. By higher resolution I mean I need more number of minor ticks on the scale. I couldn't find a way to achieve it with the current api. So i subclassed QwtThermo(QwtThermoSubclass) and used QAbstractScale::setScaleEngine() to set a scaleEngine of my own.(NewScaleEngine)
    In the NewScaleEngine I basically give the ticksList. I have two variable majorDivision, minorDivisions, and use them to give the tick list.
    For the values of majorDivision and minorDivision in constructor of NewScaleEngine, it works alright. When i try to change the variables in the runtime and call the QWidget::update, the scale is not redrawn.
    Am i using a wrong method?


    Added after 35 minutes:


    QAbstractScale::rescale is the answer.
    Last edited by pkj; 5th February 2012 at 13:56.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtThermo scale update

    I need a QwtThermo with a scale with higher resolution. By higher resolution I mean I need more number of minor ticks on the scale
    Qt Code:
    1. thermo->setScaleMaxMinor( 20 );
    To copy to clipboard, switch view to plain text mode 
    In the NewScaleEngine I basically give the ticksList.
    This is what "QwtAbstractScale::setScale( const QwtScaleDiv & );" does.

    5 minutes reading the class API would have saved you a lot of time for writing useless code.

    Uwe
    Last edited by Uwe; 6th February 2012 at 06:32.

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

    pkj (6th February 2012)

  4. #3
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtThermo scale update

    I knew there has to be a easier way out. I did go through the API and always carried the perception that QwtScaleDiv always does the drawing part and it is the QwtScaleEngine gives the ticks list. Maybe I confused QwtScaleDiv with QwtScaleDraw.
    What I don't understand is how the scaleDraw is provided with the QwtScaleDiv instance which it uses to draw the ticks? Suppose the QwtScaleDiv is being provided by the QwtScaleEngine using its divideScale function, how and where the QwtScaleDraw gets this instance, for it doesn't call it explicitly.
    I know I am getting into control flow of the library, which I as a lib user is a no-go, but it sure does help to know.

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtThermo scale update

    Qwt is open source - check the implementation of QwtAbstractScale.

    Uwe

  6. #5
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtThermo scale update

    Hmm.. got it.
    I must congratulate you on the good design that your library has. This is slightly off-topic, but could I ask you that how you arrived at such a beautiful design? Was it just the iterations which made it better over time. Or there are some guidelines/books which makes one better. Not that I haven't read a few, but it rarely gives me any mileage.

Similar Threads

  1. Replies: 5
    Last Post: 5th November 2010, 17:26
  2. Replies: 2
    Last Post: 29th September 2010, 17:44
  3. QLinearGradient and QwtThermo
    By Marco Trapanese in forum Qwt
    Replies: 2
    Last Post: 6th June 2010, 07:33
  4. QwtThermo: origin of the fill
    By Marco Trapanese in forum Qwt
    Replies: 0
    Last Post: 31st May 2010, 14:50
  5. QwtThermo ScalePos
    By jhowland in forum Qwt
    Replies: 1
    Last Post: 30th December 2009, 01:53

Tags for this Thread

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.