gamecreature / QtAwesome

QtAwesome - Font Awesome for Qt Applications
Other
787 stars 149 forks source link

Add iconLink method for dynamic generation file resource of icon #14

Closed kafeg closed 8 years ago

kafeg commented 8 years ago

I need to use icons in my Android app. In QML, i may use only existing resources.

For example, if i need set icon to standard ToolBar for android or other device, i must get file link to it and set them to iconSource property in Qt.Components.TollButton.

gamecreature commented 8 years ago

I appreciate your work for building this. Image file creation is a possibility, but I don't really like the Android specific DPI names and Types.. That doesn't belong into this library...

I'm even in doubt if this QtAwesome is what you want to use when using QML. https://github.com/QMLCommunity/font-awesome-qml
I don't know this project and I don't know if it's more useful for your uses..

Correct me if I'm wrong but isn't it much more convenient to inherit from QtAwesome. (For instance QtAwesomeAndroid) and add your additions?

kafeg commented 8 years ago

Hi. I will do small refactoring and move Android-specific code to another class, as you say.

In 'font-awesome-qml' project all code written in JS and it's impossible to do what i need.

Only your cool project give me functions to integrate icons via genered temp files to QML ad resources.

Please see my last commits, i will clear all my code from your original QtAwesome class and move them to platform specific class.

Maybe in the feature i will add analog support for iOS and WinPhone (to enums and methods).

gamecreature commented 8 years ago

I' m sorry, but I still don't think this should be part of QtAwesome...

Those platform specific Image dimensions shouldn't be here ... There are a lot of platforms out there with all kinds of different image dimensions. It's out of the scope of this project to support those dimensions. It's of course alright to start a separate project for this, but I want the core of QtAwesome to remain small.

Btw I also think you are generating a lot of temporary files this way. Every image generates a file. Even the same image in the same dimension. You should at least have a cache to reduce the number of images generated.

Btw. I've found a possible solution which works without generating temporary files, by using an ImageProvider: http://www.lothlorien.com/kf6gpe/?p=234

Maybe a custom imageprovider rending images using QtAwesome is the way to go for you.

I really appreciate your effort for submitting this pull-request. Hope you understand I'm trying to keep qtAwesome as lean as possible.

kafeg commented 8 years ago

Ok, thanks. I will save this functions in my fork.