override iconSource for compatibility

This commit is contained in:
Marco Martin 2014-07-24 19:19:26 +02:00
parent 9301163142
commit b538a1dca9
2 changed files with 7 additions and 4 deletions

View File

@ -42,6 +42,7 @@ import "styles" as Styles
* @see http://qt-project.org/doc/qt-5/qml-qtquick-controls-button.html
*/
QtControls.Button {
id: root
/**
* type:font
*
@ -51,6 +52,11 @@ QtControls.Button {
*/
property font font: theme.defaultFont
/*
* overrides iconsource for compatibility
*/
property alias iconSource: root.iconName
/**
* Smallest width this button can be to show all the contents.
* Compatibility with old Button control.

View File

@ -58,10 +58,7 @@ QtQuickControlStyle.ButtonStyle {
//control.iconSource is an url: you pass a freedesktop icon,
//and it inteprets it as an url in the local qml file filesystem path
//in order to work also with upstream controls, grossly parse the url
source: {
var url = String(control.iconSource);
return url.substring(url.lastIndexOf("/") + 1);
}
source: control.iconName || control.iconSource
anchors.verticalCenter: parent.verticalCenter
width: valid ? parent.height: 0
visible: valid