Important: Please read the Qt Code of Conduct -

Scale images in GridLayout (QML)

  • Hello. I'm trying to make scalable GridLayout, but scale doesn't work as i thought.

    import QtQuick 2.0
    import QtQuick.Controls 2.5
    import QtQuick.Layouts 1.3
    ScrollView {
        id: view
        clip: true
        contentWidth: -1
        GridLayout {
            anchors.fill: parent
            columns: 3
            Repeater {
                model: 4
                Image {
                    Layout.fillWidth: true
                    fillMode: Image.PreserveAspectFit
                    source: "/Assets/profile.png"

    After i decrease window's width my images scales to fit in Image.PreserveAspectFit mode. But the cell's height does not changed. So i have some kind of spacing between rows (Screenshots applied). How can i achieve proper aspect ration scale for GridLayout itself?

Log in to reply