Skip to content

ToolBar: Fix layout of background, strip out duplicated heuristics on position

ivan tkachenko requested to merge work/ratijas/fix-toolbar into master

The approach adopted in bf544dd8 did not account for separator's height in its margins-based solution; and overall it didn't quite work anyway, because bottomMargin does nothing without a bottom or fill anchor set. Soit resulted in a bug where separator would stick out of header's boundaries, effectively being misaligned with an application header.

This patch resolved the issue by assigning anchors one by one imperatively in a boring but reliable way. And a state machine, in my opinion, would've been too heavy for a control which is not even supposed to change position state during its lifetime under normal circumstances.

Speaking of boring ways, interestingly, QML Engine allows writing this:

required property T.ToolBar control
control.onPositionChanged: __fixup()

but for some reason it does amusingly nothing, so let's stick to the usual Connections object.

Apart from that, reduces duplicates of heuristics about position based on assumed parent.footer property, and fixes the only one left so it does not cause noise in console when a ToolBar's parent doesn't have a relevant property in it. In fact, I'm against having any heuristics here at all, as it would mask some subtle bugs for 3rd party developers that might also want to run with other QQC2 themes.

BUG: 476744

Merge request reports