Fix visual issues with long labels in the open project dialog

The following issues are fixed:
 * Printer/Quality/Material names will be wrapped if they are too long
 * The width of the window is determined based on the content of the dialog.
	With that there will not longer be overlap between the dialog content and the buttons.
This commit is contained in:
Kostas Karmas 2020-08-21 14:50:00 +02:00
parent 37855e7d19
commit 4e87f37791

View file

@ -16,7 +16,7 @@ UM.Dialog
minimumWidth: UM.Theme.getSize("popup_dialog").width minimumWidth: UM.Theme.getSize("popup_dialog").width
minimumHeight: UM.Theme.getSize("popup_dialog").height minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth width: minimumWidth
height: minimumHeight height: Math.max(dialogSummaryItem.height + 2 * buttonsItem.height, minimumHeight) // 2 * button height to also have some extra space around the button relative to the button size
property int comboboxHeight: 15 * screenScaleFactor property int comboboxHeight: 15 * screenScaleFactor
property int spacerHeight: 10 * screenScaleFactor property int spacerHeight: 10 * screenScaleFactor
@ -35,7 +35,9 @@ UM.Dialog
Item Item
{ {
anchors.fill: parent id: dialogSummaryItem
width: parent.width
height: childrenRect.height
anchors.margins: 10 * screenScaleFactor anchors.margins: 10 * screenScaleFactor
UM.I18nCatalog UM.I18nCatalog
@ -63,7 +65,8 @@ UM.Dialog
Column Column
{ {
anchors.fill: parent width: parent.width
height: childrenRect.height
spacing: 2 * screenScaleFactor spacing: 2 * screenScaleFactor
Label Label
{ {
@ -182,6 +185,7 @@ UM.Dialog
{ {
text: manager.machineName text: manager.machineName
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
wrapMode: Text.WordWrap
} }
} }
@ -239,6 +243,7 @@ UM.Dialog
{ {
text: manager.qualityName text: manager.qualityName
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
wrapMode: Text.WordWrap
} }
} }
Row Row
@ -254,6 +259,7 @@ UM.Dialog
{ {
text: manager.intentName text: manager.intentName
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
wrapMode: Text.WordWrap
} }
} }
Row Row
@ -285,6 +291,7 @@ UM.Dialog
{ {
text: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges) text: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges)
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
wrapMode: Text.WordWrap
} }
visible: manager.numSettingsOverridenByQualityChanges != 0 visible: manager.numSettingsOverridenByQualityChanges != 0
} }
@ -346,6 +353,7 @@ UM.Dialog
{ {
text: modelData text: modelData
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
wrapMode: Text.WordWrap
} }
} }
} }
@ -419,6 +427,14 @@ UM.Dialog
} }
} }
} }
}
Item
{
id: buttonsItem
width: parent.width
height: childrenRect.height
anchors.bottom: parent.bottom
anchors.right: parent.right
Button Button
{ {
id: cancel_button id: cancel_button
@ -432,13 +448,14 @@ UM.Dialog
Button Button
{ {
id: ok_button id: ok_button
anchors.right: parent.right
anchors.bottom: parent.bottom
text: catalog.i18nc("@action:button","Open"); text: catalog.i18nc("@action:button","Open");
onClicked: { manager.closeBackend(); manager.onOkButtonClicked() } onClicked: { manager.closeBackend(); manager.onOkButtonClicked() }
anchors.bottom: parent.bottom
anchors.right: parent.right
} }
} }
function accept() { function accept() {
manager.closeBackend(); manager.closeBackend();
manager.onOkButtonClicked(); manager.onOkButtonClicked();