yLeft axis constant width
I made an array (vertically ) of qwtplot that xBottom axis are synchronized ( just like the plot matrix). Now my problem is that yLeft axis values are changing , so the number of digits will shrink and expand in effect this will misallign my xBottom axis.
My idea of a solution would be to have a constant width on QwtScaleWidget by setting minimumWidth() to something like the width of 6 digits numbers. but this is kinda hacky. Is there an elegant solution to my woes uwe?
By the way i tried setting QwtScaleWidget's minimumWidth and found that the canvas won't respect QwtScaleWidget.
scalewidget was overdrawn by the canvas
baray98
Re: yLeft axis constant width
More debugging showed me that by adjusting scaleDraw to the max width of all yLeft axis will do the trick.. but changes ( or redraw) is not visible until I will resize the widget. I have tried both replot and repaint on each plot and nothing happens.
Uwe how will i trigger a redraw after changing scaleDraw's minimumExtent ?
baray98
Re: yLeft axis constant width
What about QwtPlot::updateLayout() ?
You can call updateLayout() manually, but it is also called internally for each LayoutRequest event. AFAIR this event is posted by QWidget::updateGeometry(), so I guess you could also do plot->updateGeometry(). Using LayoutRequest events might be preferable as several LayoutRequest can be collected by Qt to a single one.
Uwe
Re: yLeft axis constant width
updateLayout will do the trick but not updateGeometry();
solved
baray98
Re: yLeft axis constant width
I am working on the same problem. Why doesn't the canvas respect the axis widget's minimumWidth()? Is this a bug?
Also, QwtPlot::updateLayout is not a slot, so I can't just do:
Code:
connect(m_ui
->qwtPlot
->axisWidget
(QwtPlot::yLeft),
SIGNAL(scaleDivChanged
()),
m_ui->qwtPlot, SLOT(updateLayout()));
to work around this.
Added after 1 6 minutes:
This seems to do the trick:
Code:
m_ui
->qwtPlot
->axisWidget
(QwtPlot::xBottom)->setMinBorderDist
(90,
20);
m_ui->qwtPlot->plotLayout()->setAlignCanvasToScales(true);
This has some side effects I don't really like (the canvas doesn't stretch to the edge on the top and right) but it helps with a lot of the flickering when axis labels change.