Results 1 to 2 of 2

Thread: Questions for "Friedberg" sample

  1. #1
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Questions for "Friedberg" sample

    I am studying this sample to understand qwt library class structure and I am using "Friedberg" sample as a starting point.

    Question #1: Ticks

    I understand MajorTicks as ones for which the label is drawn. I did not find the way to provide labels for MinorTicks and MediumTicks.
    Is that correct?

    Please let me know if it is possible to provide labels for Minor/Medium types of ticks.
    The only method I found was protected member
    const QwtText& QwtScaleDraw::tickLabel (const QFont & font, double value )const;

    Overriding it in YearScaleDraw did not produce the label for the minor or medium ticks.


    Question #2:
    I change YearScaleDraw() constructor to assign values 4, 8, 24 for Minor, Medium and Major ticks respectively.

    When FriedBerg sample starts it is show like this:
    s1.jpg

    Then I do zoom and, after zooming, it looks like this:
    s2.jpg

    Then I zoom back (right-mouse click) and it goes back to the original view as shown below, except that the X-scale is drawn differently compared to the first screenshot.
    s3.jpg

    Why is that?

  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: Questions for "Friedberg" sample

    Quote Originally Posted by TorAn View Post
    I did not find the way to provide labels for MinorTicks and MediumTicks.
    Because there is none.

    Question #2:
    Something on my TODO list is to add the functionality to display labels in the middle between 2 major ticks. This is a typical use case for date time intervals.

    The friedberg example shows a hack, that sets the length of the major ticks to 0 and enlarges the medium ticks to fake being major ticks. But this works for scales only, where the ticks are set manually from the application - in case of zooming in/out the ticks are calculated from the scale engine.

    So the friedberg example is probably not the best code to learn about scales in Qwt.

    Uwe

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

    TorAn (1st May 2011)

Similar Threads

  1. Replies: 3
    Last Post: 15th February 2010, 17:27
  2. questions about "Custom item roles"
    By calmspeaker in forum Qt Programming
    Replies: 5
    Last Post: 9th September 2008, 20:54
  3. Replies: 3
    Last Post: 8th July 2008, 19:37
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.