Re: Layout sizeHint weird behavior
Brought to you by:
rathmann
From: Giacomo S <gia...@el...> - 2024-08-09 12:41:18
|
Actually, a call to replot() fixed the issue. I don't know whether it's the best option or not. A simple updateAxes may be more lightweight. Why is the default setting of QwtScaleWidget 0-100 if a plot shows 0 - 1000 when it is actually drawn? On 8/9/24 2:13 PM, Uwe Rathmann wrote: > On 8/8/24 10:10, Giacomo S wrote: > >> Well, printing the list of major ticks, *before* the default scale >> bounds are set from 0 to 1000 with 6 major ticks, this is what I get: >> >> QwtPlot.sizeHint: Y axis ticks: 0.000000, 10.000000, 20.000000, >> 30.000000, 40.000000, 50.000000, 60.000000, 70.000000, 80.000000, >> 90.000000, 100.000000, > > The default setting of QwtScaleWidget is [0,100]. > >> I think there is something (temporarily) wrong in the initialization >> of the scales. > > Well the size hints of the plot depends on the hints from the scales > and the hint of a scale depend on its ticks. The ticks are set in > QwtPlot::updateAxes, what can be called explicitly or implicitly from > replot. So yes - the size hint of the plot is not updated before > updateAxes has been called. > > But note, that any QWidget has to indicate changes of its size hint by > posting a QEvent::LayoutRequest. This might be done by > QWidget::updateGeometry() or manually like in QwtPlot::replot. > > When working with Qt layouts the event should be handled by them. If > not you could implement an event handler in the parent of your plot > widget. > > HTH, > Uwe > > > > _______________________________________________ > qwt-interest mailing list > qwt...@li... > https://lists.sourceforge.net/lists/listinfo/qwt-interest |