Results 1 to 6 of 6

Thread: Distance between axis title and widget border

  1. #1
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Distance between axis title and widget border

    Hi,

    I use rich text in my labels. when I have <sup> in the title of left axis, the <sup>-text is not visible completely - it is drawn "outside the borders". the same behaviour is at bottom title and <sub>.

    How can I increase the distance between axis title and widget border? I already tried setMinimumExtent() for the PlotScaleDraws but that did not change anything, the title is still printed at the border.

    any ideas?
    Felix

  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: Distance between axis title and widget border

    Qt Code:
    1. plot->axisWidget(...)->setContentsMargins( ... );
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. #3
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Distance between axis title and widget border

    hm... I tried the following, but that did not change anything:

    Qt Code:
    1. plot->setAxisTitle(id, text);
    2. plot->axisWidget(id)->setContentsMargins(100, 100, 100, 100);
    To copy to clipboard, switch view to plain text mode 

    I tried your suggestion in the bode example without success too.

  4. #4
    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: Distance between axis title and widget border

    Indeed, setting contents margins doesn't work.

    But setting a margin to work around layout problems is not the right solution. Instead I would like to find out why the text is truncated.

    What environment are you using, what fonts and what is your axis title in detail ?

    Uwe

  5. #5
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Distance between axis title and widget border

    I'm sorry, I should have tested a bit more. The problem seems to affect only the font "MS Sans Serif" (in all tested sizes). All other (now tested) fonts seem to be printed correctly.

    I use Win7 64bit. axis was yLeft (xBottom worked fine - with <sub> instead of <sup> of course), title = "<html> Kinetic Energy [10<sup>3</sup>eV]</html>"

    thanks for your help!

  6. #6
    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: Distance between axis title and widget border

    Well - the Qwt layout code relies on the geometries returned by Qt. If there is something wrong for a special font only I'm afraid there is not much I can do on my side.

    Anyway - to find out more about this problem please check the code in QwtRichTextEngine::heightForWidth and QwtRichTextEngine::textSize and see what goes wrong with this font on your system.

    Uwe

Similar Threads

  1. QwtPlot Change Axis Title Alignment
    By deepy in forum Qwt
    Replies: 5
    Last Post: 20th October 2010, 13:40
  2. How to remove QMainWindow's title and border
    By meraj ansari in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2010, 17:22
  3. Replies: 1
    Last Post: 5th January 2010, 21:00
  4. Replies: 4
    Last Post: 13th July 2009, 18:18
  5. Set axis title on the right side
    By pospiech in forum Qwt
    Replies: 1
    Last Post: 14th March 2008, 07:26

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.