fix icon loading

This commit is contained in:
Marco Martin 2011-11-03 16:53:11 +01:00
parent 478cd9d3f0
commit a462112815
2 changed files with 8 additions and 30 deletions

View File

@ -48,7 +48,7 @@ Dialog {
id: root id: root
property alias titleText: titleAreaText.text property alias titleText: titleAreaText.text
property url titleIcon property string titleIcon
property variant buttonTexts: [] property variant buttonTexts: []
property bool privateCloseIcon: false property bool privateCloseIcon: false
@ -111,8 +111,8 @@ Dialog {
id: titleLayoutHelper // needed to make the text mirror correctly id: titleLayoutHelper // needed to make the text mirror correctly
anchors { anchors {
left: parent.left right: parent.right
right: titleAreaIcon.source == "" ? parent.right : titleAreaIcon.left left: titleAreaIcon.source == "" ? parent.left : titleAreaIcon.right
top: parent.top top: parent.top
bottom: parent.bottom bottom: parent.bottom
leftMargin: parent.margins.left leftMargin: parent.margins.left
@ -134,35 +134,14 @@ Dialog {
} }
} }
Image { IconLoader {
id: titleAreaIcon id: titleAreaIcon
width: theme.iconSizeSmall
anchors.right: parent.right height: theme.iconSizeSmall
source: titleIcon
anchors.left: parent.left
anchors.rightMargin: 4 anchors.rightMargin: 4
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
source: internal.iconSource()
sourceSize.height: 16
sourceSize.width: 16
MouseArea {
id: iconMouseArea
property bool pressCancelled
anchors.centerIn: parent
width: parent.width + 4
height: parent.height + 4
enabled: privateCloseIcon && root.status == DialogStatus.Open
onPressed: {
pressCancelled = false
}
onClicked: {
if (!pressCancelled)
root.reject()
}
onExited: pressCancelled = true
}
} }
} }

View File

@ -51,7 +51,6 @@ CommonDialog {
property string message property string message
property string acceptButtonText property string acceptButtonText
property string rejectButtonText property string rejectButtonText
property alias icon: root.titleIcon // for backwards compatibility
onAcceptButtonTextChanged: internal.updateButtonTexts() onAcceptButtonTextChanged: internal.updateButtonTexts()
onRejectButtonTextChanged: internal.updateButtonTexts() onRejectButtonTextChanged: internal.updateButtonTexts()