Results 1 to 7 of 7

Thread: HOWTO: limit title in QwtPlotCurve?

  1. #1
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question HOWTO: limit title in QwtPlotCurve?

    Hello,

    How can i limit the length of a title of instances of QwtPlotCurve's? (in a QwtPot..)
    I have long file names so the title needs > 50% of the window -size. (see Atachement)
    Or maybe it is possible to limit the horizontal scrollbar of the text?

    i already tried a bit of:
    http://www.qtcentre.org/threads/3196...itle-word-wrap
    but without success,

    like

    Qt Code:
    1. ...
    2. QwtText Filename2(PlotFileName2);
    3. Filename2.setRenderFlags(Filename2.renderFlags() | Qt::TextWordWrap);
    4. Curve3->setTitle(Filename2);
    5. Curve3->title().renderFlags();
    6. Curve3->title().MinimumLayout;
    To copy to clipboard, switch view to plain text mode 

    thanx in Advance Astronomy
    Attached Images Attached Images
    Last edited by Astronomy; 30th June 2010 at 14:14.

  2. #2
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: HOWTO: limit title in QwtPlotCurve?

    Info:
    until now i found
    QwtLegend* legend = new QwtLegend(this);

    and i'm trying with:
    legend->setDisplayPolicy(..);
    legend->setBaseSize(..)


    A.
    Last edited by Astronomy; 2nd July 2010 at 15:30.

  3. #3
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: HOWTO: limit title in QwtPlotCurve?

    I fixed it with:
    http://www.qtcentre.org/threads/3121...-inconsistency.


    Qt Code:
    1. QwtLegend* legend = new QwtLegend(this);
    2. legend->setMaximumWidth(100);
    3. legend->setMinimumWidth(100);
    4. legend->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    5. insertLegend(legend, QwtPlot::RightLegend );
    To copy to clipboard, switch view to plain text mode 

    but the legend uses always too much window-space
    i'm searching again.. (-:
    Attached Images Attached Images
    Last edited by Astronomy; 2nd July 2010 at 15:43.

  4. #4
    Join Date
    Apr 2008
    Posts
    32
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: HOWTO: limit title in QwtPlotCurve?

    As I can see scrollbar below legend items a suggest to investigate your layout managment (QHBox, QSpaceritem and so on).

  5. #5
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: HOWTO: limit title in QwtPlotCurve?

    Thanx for the sugesstion,

    The problem is: you could not edit QwtPlot with the Designer or it does not have a user interface - ui variable..

    but i will look in that direction,
    maybe in qwtplot.h , qwtplot.cpp are some public member functions which will fit in.
    thanx Astronomy

  6. #6
    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: HOWTO: limit title in QwtPlotCurve?

    The simples way to limit the title is to limit the title. It' s your application, that sets the title to the curve.

    If this is not possible you have to derive from QwtPlotLegendItem and reimplement sizeHint(). Then overload QwtPlotCurve::legendItem(), where you return your derived item.

    Uwe

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

    Astronomy (20th July 2010)

  8. #7
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: HOWTO: limit title in QwtPlotCurve?

    Thank you Uwe,

    i'll try that.

    (It's not possible to limit the title for me, because i'll calculate > 300 Models, and the settings are in the title for finding the right one again )

    lg. Astronomy

Similar Threads

  1. Replies: 1
    Last Post: 6th May 2010, 07:25
  2. Different symbol on a QwtPlotCurve
    By jomarin in forum Qwt
    Replies: 3
    Last Post: 24th March 2010, 10:27
  3. QwtPlotCurve Selection
    By WXNSNW in forum Qwt
    Replies: 1
    Last Post: 5th August 2009, 07:41
  4. How to get a custom QwtPlotCurve?
    By luffy27 in forum Qwt
    Replies: 1
    Last Post: 6th June 2007, 23:11

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.