Results 1 to 2 of 2

Thread: Label on QwtDateScaleDraw vanishes once and get back, strange behavior

  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Label on QwtDateScaleDraw vanishes once and get back, strange behavior

    Hello,

    in my application it is possible to switch on the x-axis between

    QwtLinearScaleEngine/HourMinuteSecondsScaleDraw (relative time starting from zero)

    and

    QwtDateScaleEngine/DateScaleDraw (absolute time starting at UTC Offset).

    Our time values is a double in seconds and the lables are overloaded
    (but that is not the source for this behavior. Without them just wrong labels are shown
    but it happens also. I add these only because the labels are not original Qwt if someone
    asking for that.)

    QwtScaleDraw for QwtLinearScaleEngine:
    Qt Code:
    1. class HourMinuteSecondsScaleDraw: public QwtScaleDraw
    2. {
    3. public:
    4. virtual QwtText label( double value ) const
    5. {
    6. QTime n(0,0,0);
    7. QTime t;
    8. t = n.addSecs( value );
    9. return t.toString(Qt::ISODate);
    10. }
    11. };
    To copy to clipboard, switch view to plain text mode 

    QwtScaleDraw for QwtDateScaleEngine:

    Qt Code:
    1. class DateScaleDraw: public QwtDateScaleDraw
    2. {
    3. public:
    4. DateScaleDraw( Qt::TimeSpec spec) : QwtDateScaleDraw (spec)
    5. {
    6. }
    7.  
    8. virtual QwtText label( double value ) const
    9. {
    10. return QwtDateScaleDraw::label( value*1000 );
    11. }
    12. };
    To copy to clipboard, switch view to plain text mode 

    1.) when i start a measurement with QwtLinearScaleEngine/HourMinuteSecondsScaleDraw
    everything is fine and the lables are always visible at any time.
    01 QwtLinearScaleEngine ISODateScaleDraw.jpg

    2.) when i start a measurement with QwtDateScaleEngine/DateScaleDraw for the first
    measurement data the labels vanishes and return when 2 measurment points in out data.
    02 QwtDateScaleEngine and DateScaleDraw.jpg

    It is hard to find a good entry point for debugging or why this happens. Can anybody
    give me a hint why the lables for QwtDateScaleDrawEngine vanishes shortly?

    Thx

  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: Label on QwtDateScaleDraw vanishes once and get back, strange behavior

    When working with the QwtDateScale classes values need to be dates: stored as ms since Epoch ( see http://qwt.sourceforge.net/class_qwt_date.html#details )
    But to me it looks like you are looking for something like this: http://sourceforge.net/p/qwt/feature-requests/56

    Uwe

Similar Threads

  1. strange behavior of QMapIterator
    By alainstgt in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2015, 11:53
  2. strange behavior of paintEvent
    By hashb in forum Qt Programming
    Replies: 3
    Last Post: 30th August 2010, 07:48
  3. QAudioInput example strange behavior
    By m15ch4 in forum Qt Programming
    Replies: 0
    Last Post: 13th August 2010, 06:55
  4. Strange resize behavior
    By Lykurg in forum Newbie
    Replies: 3
    Last Post: 9th January 2007, 13:56
  5. scrollbars strange behavior
    By siniy in forum Qt Programming
    Replies: 6
    Last Post: 29th December 2006, 10:27

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.