1 Attachment(s)
Axis problem with tiling QWTplots
Hello,
I use qwt-5.2.1. I want to make a grid of graphs and to put y-axis only in the graphs on the left column and put x-axis only in the graphs on the bottom row. A picture is attached to give the idea. I have done this with Qwtplot with enableAxis and QGridLayout. However, as one can see in the picture, the size of a plot window with axes becomes smaller than that witout axis. For example, the size of the top left graph is smaller than the one on the right.
Would there be a way to fix this without changing the code too much? If not, what is the best way to handle this?
Thanks a lot,
Daisuke
Re: Axis problem with tiling QWTplots
just an idea:
Code:
plotWithoutAxis->setWidth(plotWithAxis->canvas()->width())
Re: Axis problem with tiling QWTplots
Thank you for the reply. Would it be possible to get a width (or size) of a canvas? canvas()->width() doesn't seem to work and I can't find a relevant member function in the document on QwtPlotCanvas class.
Thanks,
daisuke
Re: Axis problem with tiling QWTplots
since QwtPlotCanvas) is inherited from QFrame, "int QFrame::frameWidth()" should do it...
Re: Axis problem with tiling QWTplots
You could calculate the additional space for the left/bottom axis from the sizeHints and try to adjust the stretch factors for the first row and last column of your grid layout with it.
But in the end better forget about the grid layout and reimplement the resize event of your container widget where you do setGeometry manually for all of your plot widgets.
Uwe
Re: Axis problem with tiling QWTplots
Quote:
Originally Posted by
Uwe
reimplement the resize event of your container widget where you do setGeometry manually for all of your plot widgets.
Uwe
I don't have a clear idea how one could do this since I don't have a lot of eypereince with Qwt. I would appreciate if you could give me more detailed explanation.
Re: Axis problem with tiling QWTplots
Quote:
Originally Posted by
dtakeshita
I don't have a clear idea how one could do this since I don't have a lot of eypereince with Qwt. I would appreciate if you could give me more detailed explanation.
This is Qt ( no Qwt ) know how. Overload the resizeEvent of the widget, where you have your QGridLayout and lay out your plot widgets manually using QWidget::setGeometry.
Uwe
Re: Axis problem with tiling QWTplots
Quote:
Originally Posted by
Uwe
This is Qt ( no Qwt ) know how. Overload the resizeEvent of the widget, where you have your QGridLayout and lay out your plot widgets manually using QWidget::setGeometry.
Uwe
Thank you for educating me! I will look into this option.