Skip to content

applet: Fix layout of the network speed graph with certain font preferences

ivan tkachenko requested to merge work/ratijas/axis into master

applet: Fix layout of the network speed graph with certain font preferences

TextMetrics uses a different text rendering backend by default, which has led to inaccurate estimation of the width of AxisLabels. By default TextMetrics uses QtRendering type; but our Label uses NativeRendering. In past we used to override renderType with a conditional expression, so considering such history, hardcoding any type seems inappropriate. That's why we need an actual instance of Label to fetch a correct render type at runtime.

Second part of the issue was that instead of width property the layout should have used advanceWidth, and ceil() it, just in case. But with a port to Label instance it doesn't matter anymore.

BUG: 461483

Untangle and improve layout of the network speed graph

Instead of reserving leftMargin on the graph for axis labels and then anchoring to the graph's right side to fit labels in that gap, lay it out in a more straightforward way: axis is anchored to parent.left, bind simple expression for width, and anchor the graph with a small fixed margin. Also, top-level Layout.leftMargin makes the whole thing not stick to the delegate's edges, and is now consistent with the Legend item below.

Edited by ivan tkachenko

Merge request reports