Skip to content
Commit 3da9fda9 authored by David Edmundson's avatar David Edmundson
Browse files

Fix flickering in table view

We have a list of delegates:

Whenever we get a layoutChange signal (from a re-order), table view
recycles all of them. Every binding, text and value changes.

Our backgrounds have two rectangles:

    One does a white or grey line:
```
color: (row % 2 == 0) ? Kirigami.Theme.backgroundColor :
Kirigami.Theme.alternateBackgroundColor
```

    One draws the highlight:
```
	color: Kirigami.Theme.backgroundColor
        Kirigami.Theme.inherit: false
        Kirigami.Theme.colorSet: Kirigami.Theme.Selection
        opacity: selected ? 1: 0
```

That's all well and good, but we don't want the text to be black on
blue, so there's some code here that handles this in the parent item of
the cell background.

```
	Kirigami.Theme.colorSet: background.selected ?
Kirigami.Theme.Selection : Kirigami.Theme.View
	Kirigami.Theme.inherit: false
```

A noticable quirk there is that our background to draw the white and
grey alternating rows actually draws a blue background because it
inherits the selected colourSet from our parent Kirigami.Theme. That is
marked as being "Selection" not "View"

Why does that cause a problem?

After a reshuffle what happens is:

 - All bindings update, Qt does everything perfectly

 - The colours in the real highlight update on time

- The colours in the background are delayed because they come from the
parent ColorSet

- Kirigami theme propagation has some "event compression" before
propagating to children. IMHO this is a Kirigami bug.

- The old selected item which is now some random item renders a blue
highlight where it should be rendering the white or grey background.

This patch moves logic for the selection colour into rectangle for
drawing the main background, whic also means we explicitly set a
Kirigami.ColorSet there.

This also helps differentiate highlighted + vs highlighted + mouse over
which brings it more in line with the desktop.

BUG: 436803
(cherry picked from commit 05ca503a)
parent f67a6ebb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment