Results 1 to 3 of 3

Thread: axis text management

  1. #1
    Join Date
    Feb 2011
    Posts
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default axis text management

    I've got a function like this:

    void PlotWindow::setXAxisTitle (QString & name)
    {
    setAxisTitle(QwtPlot::xBottom, name);
    axisTitle(QwtPlot::xBottom).setRenderFlags(Qt::Ali gnRight);
    axisTitle(QwtPlot::xBottom).setText("name2",QwtTex t::RichText);
    }

    The first line works and puts (center aligned) name "name" to X axis. But the following lines, used for put title right aligned an change title text don't work! i don't understand why, any help?

    Thanks

  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: axis text management

    Qt Code:
    1. setAxisTitle(QwtPlot::xBottom, name);
    2. axisTitle(QwtPlot::xBottom).setRenderFlags(Qt::AlignRight);
    3. axisTitle(QwtPlot::xBottom).setText("name2",QwtText::RichText);
    To copy to clipboard, switch view to plain text mode 
    Of course this doesn't work - this code is manipulating the return value of a function. Instead you have to write it this way:

    Qt Code:
    1. QwtText text( "name2", QwtText::RichText );
    2. text.setRenderFlags(Qt::AlignRight);
    3. setAxisTitle(xBottom, text );
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. #3
    Join Date
    Feb 2011
    Posts
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: axis text management

    Cool, now it's works, thanks!

Similar Threads

  1. How to change the div text of axis?
    By bangqianchen in forum Qwt
    Replies: 2
    Last Post: 18th August 2010, 01:27
  2. Replies: 0
    Last Post: 9th August 2010, 10:46
  3. Histogram axis labels as text
    By DKGear in forum Qwt
    Replies: 1
    Last Post: 30th December 2008, 08:54
  4. Memory management in QT
    By Gayathri in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2006, 07:21

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.