Important: Please read the Qt Code of Conduct -

QML Image fill from Icon resource

  • Hello,
    in the widget area its is easy to work with icons but how to do in QML.
    This is my code.

                    id: leftimage
                     source: "qrc:///images/OK.ico"
                    width: 16
                    height: 16
                    fillMode: Image.Stretch
                       //fillMode: Image.PreserveAspectFit

    I have a icon file with different sizes in it 16x16 24x24 ...... 48x48.
    It seem that the Image takes the large size and and scales to it.
    How can I resize such an Image, or better pick the optimal icon image for a specific fixed size (as the QPushButton performes it) ?
    Explicit setting of with and height did not work - the Image has alway a large size

Log in to reply