Cannot resize image for ToolButton in qml
Solved
General and Desktop
-
How can I resize image for ToolButton in qml. I followed this example.
http://doc.qt.io/qt-5/qml-qtquick-controls-toolbar.html. Icons are 256x256. -
@Gojir4 You could make a custom component to simplify:
//MyToolButton.qml ToolButton { property alias source: img.source property int size: 32 Image{ id: img width: size height: size } Layout.preferredHeight: size Layout.preferredWidth: size }
And then:
MyToolButton{ source: "new.png" size: 48 }
-
@milan
you could try enabling mipmap for a smoother transformation, this will make the resizing a bit slower and is the reason why it's off by default.But if your image has a fixed size to begin with, than it doesn't matter much.
//MyToolButton.qml ToolButton { property alias source: img.source property int size: 32 Image{ id: img width: size height: size mipmap: true } Layout.preferredHeight: size Layout.preferredWidth: size }