Felix
Felix

Reputation: 7146

Qml Image mipmap

Im currently working with QML and android and I'm trying to add a multi-sized image as a resource (.qrc) and load it using Image. I found that Image has a property called mipmap to realize that, but I don't understand how to use it. I tried it with a .ico file - without success. Any suggestions how to do this? I wasn't able to find anything about it.

Here my code - although it's very simple:

Image {
    id: btnImg
    source: "qrc:/icons/btnImg.png"  //Tried an multi-sized .ico file
    mipmap: true
    ...
}

Upvotes: 0

Views: 609

Answers (2)

DenimPowell
DenimPowell

Reputation: 1083

Mipmap filtering gives better visual quality when scaling down.

I think QML Image's source is switchable when the image size is large.

Image {
    id: btnImg
    // if width is larger than 500, use the large scale image
    source: width > 500 ? "largeBtnImg.png" : "smallBtnImg.png"
    mipmap: true
    ...
}

Upvotes: 2

Cristea Bogdan
Cristea Bogdan

Reputation: 126

mipmap is used to have better visual quality, but it says nothing about multi-sized images. Probably you need to implement a custom Image component for what you need.

Upvotes: 2

Related Questions