Merge pull request #7185 from ctrlaltdavid/20809

Fixes for new modal message dialog
This commit is contained in:
Brad Hefta-Gaub 2016-02-24 16:20:40 -08:00
commit f9b55c4b87
3 changed files with 53 additions and 47 deletions

View file

@ -105,8 +105,8 @@ ModalWindow {
size: hifi.fontSizes.menuItem size: hifi.fontSizes.menuItem
color: hifi.colors.baseGrayHighlight color: hifi.colors.baseGrayHighlight
anchors { anchors {
top: parent.top; top: parent.top
left: parent.left; horizontalCenter: parent.horizontalCenter
margins: 0 margins: 0
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }

View file

@ -15,61 +15,67 @@ import "../controls-uit"
import "../styles-uit" import "../styles-uit"
Frame { Frame {
Item { HifiConstants { id: hifi }
id: modalFrame
anchors.fill: parent Rectangle {
anchors.margins: 0 id: modalFrame
readonly property bool hasTitle: window.title != "" readonly property bool hasTitle: window.title != ""
Rectangle { anchors {
anchors { fill: parent
topMargin: -hifi.dimensions.modalDialogMargin.y - (modalFrame.hasTitle ? hifi.dimensions.modalDialogTitleHeight + 10 : 0) topMargin: -hifi.dimensions.modalDialogMargin.y - (modalFrame.hasTitle ? hifi.dimensions.modalDialogTitleHeight + 10 : 0)
leftMargin: -hifi.dimensions.modalDialogMargin.x leftMargin: -hifi.dimensions.modalDialogMargin.x
rightMargin: -hifi.dimensions.modalDialogMargin.x rightMargin: -hifi.dimensions.modalDialogMargin.x
bottomMargin: -hifi.dimensions.modalDialogMargin.y bottomMargin: -hifi.dimensions.modalDialogMargin.y
fill: parent
}
border {
width: hifi.dimensions.borderWidth
color: hifi.colors.lightGrayText80
}
radius: hifi.dimensions.borderRadius
color: hifi.colors.faintGray
} }
border {
width: hifi.dimensions.borderWidth
color: hifi.colors.lightGrayText80
}
radius: hifi.dimensions.borderRadius
color: hifi.colors.faintGray
Item { Item {
visible: modalFrame.hasTitle visible: modalFrame.hasTitle
width: title.width + (window.iconText !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0) anchors.fill: parent
x: (parent.width - width) / 2 anchors {
topMargin: -parent.anchors.topMargin
leftMargin: -parent.anchors.leftMargin
rightMargin: -parent.anchors.rightMargin
}
FontAwesome { Item {
id: icon width: title.width + (window.iconText !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0)
text: window.iconText x: (parent.width - width) / 2
size: 30
color: hifi.colors.lightGrayText FontAwesome {
visible: text != "" id: icon
y: -hifi.dimensions.modalDialogTitleHeight - 5 text: window.iconText
size: 30
color: hifi.colors.lightGrayText
visible: text != ""
y: -hifi.dimensions.modalDialogTitleHeight - 5
anchors.left: parent.left
}
RalewayRegular {
id: title
text: window.title
elide: Text.ElideRight
color: hifi.colors.baseGrayHighlight
size: hifi.fontSizes.overlayTitle
y: -hifi.dimensions.modalDialogTitleHeight
anchors.right: parent.right
}
}
Rectangle {
anchors.left: parent.left anchors.left: parent.left
}
RalewayRegular {
id: title
text: window.title
elide: Text.ElideRight
color: hifi.colors.baseGrayHighlight
size: hifi.fontSizes.overlayTitle
y: -hifi.dimensions.modalDialogTitleHeight
anchors.right: parent.right anchors.right: parent.right
height: 1
color: hifi.colors.lightGray
} }
} }
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: 1
color: hifi.colors.lightGray
visible: modalFrame.hasTitle
}
} }
} }

View file

@ -88,7 +88,7 @@ Fadable {
property var activator: MouseArea { property var activator: MouseArea {
width: frame.decoration.width width: frame.decoration.width
height: frame.decoration.height height: frame.decoration.height
x: frame.decoration.anchors.margins x: frame.decoration.anchors.leftMargin
y: frame.decoration.anchors.topMargin y: frame.decoration.anchors.topMargin
propagateComposedEvents: true propagateComposedEvents: true
acceptedButtons: Qt.AllButtons acceptedButtons: Qt.AllButtons
@ -106,7 +106,7 @@ Fadable {
property var swallower: MouseArea { property var swallower: MouseArea {
width: frame.decoration.width width: frame.decoration.width
height: frame.decoration.height height: frame.decoration.height
x: frame.decoration.anchors.margins x: frame.decoration.anchors.leftMargin
y: frame.decoration.anchors.topMargin y: frame.decoration.anchors.topMargin
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.AllButtons acceptedButtons: Qt.AllButtons