Skip to content

Commit

Permalink
fix(icon): Support non-qrc icons in a user location
Browse files Browse the repository at this point in the history
  • Loading branch information
iBelieve committed Jun 16, 2016
1 parent c82b334 commit 422fa4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/Icon.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ Item {
} else if (icon.source.indexOf('icon://') === 0) {
var name = icon.source.substring(7)

if (name)
return "qrc:/icons/" + name + '.svg'
else
if (name) {
if (Theme.iconsRoot.indexOf('qrc') != -1)
return Theme.iconsRoot + '/' + name + '.svg'
else
return Theme.iconsRoot + '/' + name.replace('/', '_') + '.svg'
} else {
return ""
}
} else {
return icon.source
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Object {
light: false
}

property string iconsRoot: "qrc:/icons"

/*!
A utility method for changing the alpha on colors. Returns a new object, and does not modify
the original color at all.
Expand Down

1 comment on commit 422fa4b

@SunRain
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, would please like to review this pr #429
I think it is better than this, as it support qml file compiled into binary while images still in single files( I think compile images into qrc would make binary big).

Please sign in to comment.