KCM: Dynamically resize QMLOutput root dimensions directly in QML
AbandonedPublic

Authored by dvratil on Dec 21 2017, 3:25 PM.

Details

Summary

Removes the need for calling QMLOutput::updateRootProperties() from
arbitrary places. This way the root dimensions will always be up-to-date.

This fixes snapping when output scaling changes.

Diff Detail

Repository
R104 KScreen
Lint
Lint Skipped
Unit
Unit Tests Skipped
dvratil created this revision.Dec 21 2017, 3:25 PM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 21 2017, 3:25 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
dvratil requested review of this revision.Dec 21 2017, 3:25 PM
apol added a subscriber: apol.Dec 21 2017, 3:41 PM
apol added inline comments.
kcm/qml/Output.qml
46

If you pass item.rotation as an argument, qml will pick up the change automatically. Can't rotation change?

QML is clever enough to re-evaluate the function when item.rotation or dimensions change.

apol added a comment.Dec 21 2017, 3:53 PM

QML is clever enough to re-evaluate the function when item.rotation or dimensions change.

Not if it's within _transformedSize()

In D9460#182151, @apol wrote:

QML is clever enough to re-evaluate the function when item.rotation or dimensions change.

Not if it's within _transformedSize()

It actually does, since the function depends on the object. Try running this and resize the window:

import QtQuick 2.0

Rectangle {
    id: root
    anchors.fill: parent
    color: "red"

    function f(item) {
        if (item.width > 1000) {
            console.log("Wide");
        } else {
            console.log("Narrow");
        }
        return 0
    }

    rotation: f(root)
}
apol accepted this revision.Dec 21 2017, 4:03 PM

Go for it then, good riddance of that code. :)

This revision is now accepted and ready to land.Dec 21 2017, 4:03 PM
dvratil abandoned this revision.Feb 25 2020, 4:14 PM