diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-07-09 17:47:51 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-07-09 17:47:51 +0300 |
commit | 0db1f1034b164b783ff395afc87e7cdc1e13a183 (patch) | |
tree | b776bf235197e4309b81bb10613b15e12b7a8a1c /plugins | |
parent | 5bc384830114fb4144709784441f0c5900900bb9 (diff) |
Add header, and make popup grow to its contents
It was quite a hassle to allow the column to grow to the size of its contents. For some reason, things update the size to 0. And the size updates again once the pop-up actually gets opened for the first time, because then the column actually gets populated lazily.
Contributes to issue CURA-8008.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/PrepareStage/PrepareMenu.qml | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 219979407b..1916a5813d 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -1,7 +1,7 @@ // Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.9 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.3 @@ -99,11 +99,39 @@ Item sourceSize.height: height } - contentItem: Rectangle + contentItem: Item { - width: 100 - height: 100 - color: "red" + id: popup + width: openProviderColumn.width + height: openProviderColumn.height + + Column + { + id: openProviderColumn + + //The column doesn't automatically listen to its children rect if the children change internally, so we need to explicitly update the size. + onChildrenRectChanged: + { + popup.height = childrenRect.height + popup.width = childrenRect.width + } + onPositioningComplete: + { + popup.height = childrenRect.height + popup.width = childrenRect.width + } + + Label + { + text: catalog.i18nc("@menu:header", "Open file") + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("medium") + renderType: Text.NativeRendering + + width: contentWidth + height: contentHeight + } + } } } |