Draw the tic label of a Qwt3D plot in two separate lines
Hi guys,
Thanks in advance. I'm triying to show the lable of the tics in a Qwt3D in two lines. To do that , I needed to create a new class that inherits from LineraScale class, and then overwrite the ticLabel member function.
Header class
Code:
class myScale: public LinearScale
{
public:
Scale* clone() const {return new myScale();}
QString ticLabel
(unsigned int idx
) const;
};
The cpp file
Code:
QString myScale
::ticLabel(unsigned int idx
) const {
return QString("This is 1st line" + "\n" + "this should be the 2nd one" );
}
But when the plot is shown, the result appears in the same line "This is the 1st line this should be the 2nd one".
It is possible to do that with QwtPlot, but with this module, the "\n" has no effect.
Further info: To plot the label , internally the Qwt3D uses a Qwt3D::Label, and it sets the string with the memeber function void setString ( QString const & s ) // Sets the labels string For unicode labeling ( QChar(0x3c0) etc.) please look at www.unicode.org.
I dont know if the problem is this conversion or if the unicode labeling has any other simbol to indicate the new line.
Any idea?
Thanks!!
Re: Draw the tic label of a Qwt3D plot in two separate lines
The QwtPlot3d libs don't support this at the moment. I am also using these libs and have tried this with the 0.3.0 dev branch too and its not possible.
I would recommend getting up to speed with the new improved API in 0.3.0 since it is MUCH better at displaying axis labels on X11/Linux. If you don't use X11/Linux then its still worth working out the new APIs so you don't have to rework your code when it gets released.
Hope this helps (a little)
Re: Draw the tic label of a Qwt3D plot in two separate lines
Ok, thanks.
I was triying to modify the Qwt3D plot code, did you look at it?
There is a header called, qwt3d_portability.h where a this variable is defined:
Code:
const Qt::TextFlag SingleLine = Qt::TextSingleLine;
An then, in qwt3d_label.cpp this variable is used:
In oder to set the rectangle of the text label in a single line. I tried to replace this flag with another one,in order to avoid the single line restiction, but It doesn't work?
Did you also try this approach?
Thanks
Re: Draw the tic label of a Qwt3D plot in two separate lines
Sorry, no I just eat the porridge and wait for bug fixes :-)