2 Attachment(s)
How to move the title of the xBottm axis to its right end?
I'd like to move the xBottom axis's title position in Qwt plot. However, when I try to do that by subclassing QwtScaleWidget, I can not associate it with my plot.
Since the defualt position of the title of the xBottom axis is in the middle. I'd like to move the title to the right end of the xBottom axis while keeping the text's orientation as the following picture shown.I try to subclass my class(CustomScaleWidget) from QwtScaleWidget and overload its drawTitle() fucntion, and its position moved, but I cannot find any api in qwtplot to associate my class with my qwtplot.Then my CustomScaleWidget is a standalone widget from other widget in the plot.How can I associate it with my plot?Or Is there any other method?Thank u~
The final position is shown in the picture(beside the xbottom axis's right end,but out of the canvas).
Attachment 12056Attachment 12057
Re: How to move the title of the xBottm axis to its right end?
The alignment can be changed this way:
Code:
axisTitle.setRenderFlags( Qt::AlignRight | Qt::AlignVCenter );
axisTitle.
setFont( plot
->axisTitle
( QwtPlot::xBottom ).
font() );
plot
->setAxisTitle
( QwtPlot::xBottom, axisTitle
);
But this might still not be what you want to have as the title label is aligned to the canvas and its right end is not below the right scale.
Uwe
1 Attachment(s)
Re: How to move the title of the xBottm axis to its right end?
Yes, that's almostly what I want~As the result is shown in picture.Attachment 12058
Thank u very much, Uwe~~
However, when I look up the souce file "qwt_plot.cpp" to figure out how it works, I can not find setAxisTitle's implementation.
In file qwt_plot.h,
I can see the declaration of void setAxisTitle( int axisId, const QString & );
But in qwt_plot.cpp,I can not find its implementation.
Is this part of code not opened or my code is not the latest?
Re: How to move the title of the xBottm axis to its right end?
Re: How to move the title of the xBottm axis to its right end?
Sorry,Uwe,I typed the wrong api:
void setAxisTitle( int axisId, const QString & );
should be
void setAxisTitle( int axisId, const QwtText & );
I mean I can not find void setAxisTitle( int axisId, const QwtText & );
's implementation not declaration.
The downloaded code is qwt-6.1,moreover,
I find other apis have no implementation: void setAxisMaxMinor( int axisId, int maxMinor );
int axisMaxMinor( int axisId ) const;
Their all seems to be attribute setting.But I can not find the responding member varible in qwtplot.
Re: How to move the title of the xBottm axis to its right end?
Maybe consider to use a better IDE ( I can recommend vi ): implementation can be found in qwt_plot_axis.cpp.
Uwe
PS: grep is your friend