Grow width of QML message box to accommodate wide title if necessary

This commit is contained in:
David Rowe 2016-03-15 07:22:21 +13:00
parent 830f53cc46
commit f75aa97728
2 changed files with 6 additions and 1 deletions

View file

@ -51,6 +51,9 @@ ModalWindow {
property int clickedButton: OriginalDialogs.StandardButton.NoButton;
focus: defaultButton === OriginalDialogs.StandardButton.NoButton
property int titleWidth: 0
onTitleWidthChanged: d.resize();
function updateIcon() {
if (!root) {
return;
@ -72,7 +75,7 @@ ModalWindow {
readonly property int maxHeight: 720
function resize() {
var targetWidth = mainTextContainer.width
var targetWidth = Math.max(titleWidth, mainTextContainer.width)
var targetHeight = mainTextContainer.height + 3 * hifi.dimensions.contentSpacing.y
+ (informativeTextContainer.text != "" ? informativeTextContainer.contentHeight + 3 * hifi.dimensions.contentSpacing.y : 0)
+ buttons.height

View file

@ -50,6 +50,8 @@ Frame {
width: title.width + (icon.text !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0)
x: (parent.width - width) / 2
onWidthChanged: window.titleWidth = width
HiFiGlyphs {
id: icon
text: window.iconText ? window.iconText : ""