Results 1 to 6 of 6

Thread: Avoiding Truncated Labels

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Avoiding Truncated Labels

    G'day Uwe,

    Thanks for your reply. Resizing the window does not alter the x scale: the truncated labels stay truncated. I cannot see any operative part of the cpuplot example that affects this; as you say, it seems to be the default behaviour.

    I have attached the full source If you'd like to look (and forgive the blatant plagiarism ).

    Regards,
    Chris

    Edit: Had a bit more of a play with this. If I explicitly set
    Qt Code:
    1. plot.setAxisScale(QwtPlot::xBottom, -100, 1);
    To copy to clipboard, switch view to plain text mode 
    in the code attached then the label is good. If, as in my broken example, you leave this out (auto scale) the label is truncated. I can probably live with this in the intended application.
    Attached Files Attached Files
    Last edited by ChrisW67; 26th June 2009 at 03:18. Reason: Possible answer

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

    Default Re: Avoiding Truncated Labels

    The layout engine of QwtPlot assumes, that the first major tick is at the left and the last one is at the right side of the scale. But in your code its the other way round.

    I will think about how to fix this bug in Qwt ( manually generated ticks need to be ordered, after they have been passed with setScaleDiv).

    In the meantime you could simply turn the order of your ticks.

    Uwe

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

    ChrisW67 (7th July 2009)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Avoiding Truncated Labels

    Thanks Uwe. In rolling the code into a real application I had rewritten it the other way around anyway.

    I would not bother handling the tick marks in reverse order, just document that they should be left-to-right or bottom-to-top.

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

    Default Re: Avoiding Truncated Labels

    Even better than documenting a bug is to fix it. ( Done in the 5.2 and trunk branches. )

    Uwe

Similar Threads

  1. Replies: 0
    Last Post: 17th April 2009, 08:58
  2. Tick Labels for Slider
    By jcraig in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 17:21
  3. setting QTreeWidget vertical labels
    By hyling in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 18:53

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.