mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 20:55:59 +08:00
Merge branch 'CURA-9143_dropdown_item_width' of github.com:Ultimaker/Cura
This commit is contained in:
commit
325bf058e0
@ -106,26 +106,34 @@ Item
|
|||||||
{
|
{
|
||||||
id: openProviderColumn
|
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.
|
// Automatically set the width to fit the widest MenuItem
|
||||||
onChildrenRectChanged:
|
// Based on https://martin.rpdev.net/2018/03/13/qt-quick-controls-2-automatically-set-the-width-of-menus.html
|
||||||
|
function setWidth()
|
||||||
{
|
{
|
||||||
popup.implicitHeight = childrenRect.height
|
var result = 0;
|
||||||
popup.implicitWidth = childrenRect.width
|
var padding = 0;
|
||||||
}
|
for (var i = 0; i < fileProviderRepeater.count; ++i) {
|
||||||
onPositioningComplete:
|
var item = fileProviderRepeater.itemAt(i);
|
||||||
{
|
if (item.hasOwnProperty("implicitWidth"))
|
||||||
popup.implicitHeight = childrenRect.height
|
{
|
||||||
popup.implicitWidth = childrenRect.width
|
var itemWidth = item.implicitWidth;
|
||||||
|
result = Math.max(itemWidth, result);
|
||||||
|
padding = Math.max(item.padding, padding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result + padding * 2;
|
||||||
}
|
}
|
||||||
|
width: setWidth()
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
|
id: fileProviderRepeater
|
||||||
model: prepareMenu.fileProviderModel
|
model: prepareMenu.fileProviderModel
|
||||||
delegate: Button
|
delegate: Button
|
||||||
{
|
{
|
||||||
leftPadding: UM.Theme.getSize("default_margin").width
|
leftPadding: UM.Theme.getSize("default_margin").width
|
||||||
rightPadding: UM.Theme.getSize("default_margin").width
|
rightPadding: UM.Theme.getSize("default_margin").width
|
||||||
width: contentItem.width + leftPadding + rightPadding
|
width: openProviderColumn.width
|
||||||
height: UM.Theme.getSize("action_button").height
|
height: UM.Theme.getSize("action_button").height
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
|
@ -90,8 +90,9 @@ Column
|
|||||||
Cura.TertiaryButton
|
Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
id: cloudButton
|
id: cloudButton
|
||||||
width: UM.Theme.getSize("account_button").width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("account_button").height
|
height: UM.Theme.getSize("account_button").height
|
||||||
|
|
||||||
text: "Ultimaker Digital Factory"
|
text: "Ultimaker Digital Factory"
|
||||||
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-DF")
|
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-DF")
|
||||||
fixedWidthMode: false
|
fixedWidthMode: false
|
||||||
@ -100,8 +101,9 @@ Column
|
|||||||
Cura.TertiaryButton
|
Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
id: accountButton
|
id: accountButton
|
||||||
width: UM.Theme.getSize("account_button").width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("account_button").height
|
height: UM.Theme.getSize("account_button").height
|
||||||
|
|
||||||
text: catalog.i18nc("@button", "Ultimaker Account")
|
text: catalog.i18nc("@button", "Ultimaker Account")
|
||||||
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-account")
|
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-account")
|
||||||
fixedWidthMode: false
|
fixedWidthMode: false
|
||||||
@ -117,7 +119,11 @@ Column
|
|||||||
Cura.TertiaryButton
|
Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
id: signOutButton
|
id: signOutButton
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.getSize("account_button").height
|
||||||
|
|
||||||
onClicked: Cura.API.account.logout()
|
onClicked: Cura.API.account.logout()
|
||||||
text: catalog.i18nc("@button", "Sign Out")
|
text: catalog.i18nc("@button", "Sign Out")
|
||||||
|
fixedWidthMode: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user