Commit b17fa4be authored by Marco Martin's avatar Marco Martin
Browse files

parent full representation to the proper window at start

Summary:
this avoids some unwanted scene changes and speeds up the
first open a bit, also initialize the size of the dialog main item
so there is a resize less when the Dialog is first shown

Test Plan:
difference in show time is already visible, tough still not perfect,
something else needs to improve as well

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: apol, broulik, hein, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10692
parent e6969f2c
......@@ -26,6 +26,9 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
id: expandedRepresentation
//set width/height to avoid an useless Dialog resize
width: Layout.minimumWidth
height: Layout.minimumHeight
Layout.minimumWidth: units.gridUnit * 24
Layout.minimumHeight: units.gridUnit * 21
Layout.preferredWidth: Layout.minimumWidth
......
......@@ -105,6 +105,7 @@ MouseArea {
if (!plasmoidItemComponent) {
plasmoidItemComponent = Qt.createComponent("items/PlasmoidItem.qml");
}
//Allow the plasmoid expander to know in what window it will be
var plasmoidContainer = plasmoidItemComponent.createObject(invisibleEntriesContainer, {"x": x, "y": y, "applet": applet});
applet.parent = plasmoidContainer
......@@ -114,6 +115,25 @@ MouseArea {
applet.width = plasmoidContainer.height
applet.visible = true
plasmoidContainer.visible = true
//This is to make preloading effective, minimizes the scene changes
if (applet.fullRepresentationItem) {
applet.fullRepresentationItem.width = expandedRepresentation.width
applet.fullRepresentationItem.width = expandedRepresentation.height
applet.fullRepresentationItem.parent = preloadedStorage;
} else {
applet.fullRepresentationItemChanged.connect(function() {
applet.fullRepresentationItem.width = expandedRepresentation.width
applet.fullRepresentationItem.width = expandedRepresentation.height
applet.fullRepresentationItem.parent = preloadedStorage;
});
}
}
//being there forces the items to fully load, and they will be reparented in the popup one by one, this item is *never* visible
Item {
id: preloadedStorage
visible: false
}
Containment.onAppletRemoved: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment