Skip to content

Fix updating implicit size more than once (among other things)

ivan tkachenko requested to merge work/ratijas/update-implicit-size into master

Port manual tests from PlasmaCore to KSvg, and refactor them

Seems like selected_svg test doesn't do much. And shadows test stretches left & right columns too much.

Deduplicate implicit size checks

This change required some reordering of signals in setElementId(). While potentially harmless for "eventually consistent" declarative bindings and internally now consistent with setSvg(), I can only hope it won't break anything that depends on some very specific order of events.

As code comment states, these checks are semi-broken, as there is no way those setters could be called a second time. Needs further fixing.

SvgItem: Factor out two naturalSize() getters into a local variable

This is nothing more than a micro-optimization.

Fix updating implicit size more than once

Using the same pattern for tracking source of truth for a property as in a recent KItemModels::KSortFilterProxyModel patch, SVG items can now update their implicit size more than just once: previous check only compared value with zero and immediately wrote some (likely) non-zero value into it, so the check obviously wouldn't be true anymore on subsequent runs.

Side note: this patch packs up all boolean members into bit fields for space efficiency.


  • Unarchive background.svg file

  • Tests: Fix order of methods in header to match implementation

  • Tests: Add test for behavior of overridden implicit size properties

    This test includes an SVG of Breeze slider from plasma-framework.

Note: this patch would allow dropping lots of bindings like this from plasma components:

implicitWidth: naturalSize.width
implicitHeight: naturalSize.height

the patch is ready, and is just waiting for this to be merged.

Merge request reports