QT | QML | Load EMF file as button image

Hi,
I am building a QT Quick application using QML in which I have an tool bar and tool bar buttons.
For these tool bar buttons I want to set source as an EMF file. (http://whatis.techtarget.com/fileformat/EMF-Enhanced-Windows-Metafile) (https://msdn.microsoft.com/en-us/library/ff548726%28VS.85%29.aspx?f=255&MSPPError=-2147217396)
But it seems that QML is not able to load the EMF file. Any idea if there anyway to get EMF file to be loaded as image source in QML?
Sample source code that I am trying:
ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480
    visible: true
    toolBar:ToolBar {
             RowLayout {
               anchors.fill: parent
               ToolButton {
                   iconSource: "open.emf"
               }

               Item { Layout.fillWidth: true }
           }
       }



}
LVL 15
Karrtik IyerSoftware ArchitectAsked:
Who is Participating?
 
sarabandeCommented:
any image posted to screen needs to be converted to bitmap format since finally there is a bitblt call from memory dc to screen dc which has colours for each bit, hence is a bitmap.

if you take that in account, i wonder why you prefer to make the conversion from emf to bitmap at runtime and not simply once from .emf to .bmp file what all the libraries would support without any additional efforts.

Sara
0
 
Karrtik IyerSoftware ArchitectAuthor Commented:
I agree Sara, but our UI design team who provides us icon, images, etc.. have decided to give these in EMF format and they have suggested us not to convert it, if converted, it would be very straight forward, as I already agreed with you.
0
 
sarabandeCommented:
our UI design team who provides us icon, images, etc.. have decided to give these in EMF format and they have suggested us not to convert it
I had the same case with a third party design team at my current project. they wanted to give us icons, images and logos in photoshop format as this was their default output. their argumentation was that the pictures would look much better this way. but, actually, when displaying the images with normal windows gdi, all the advantages were lost. worse, if we would have done the conversion at runtime or with a different tool, the results would have been not acceptable cause the images were not optimized for bitmap format when doing it this way. any text in the images would look fuzzy and the colors cannot be mapped properly. so we insisted on getting bitmaps and all was good.

Sara
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.