QML Image not scaling correctly in responsive layout with Qt 6.5
Quick question that's been bugging me - Can someone help me understand I've hit a wall trying to I'm currently working with an scenario with an Image element in QML where it does not scale properly when placed within a responsive layout. My intention is to have the image fill the available space proportionately while maintaining its aspect ratio. However, it appears to stretch instead when the window is resized. Hereโs a snippet of the relevant code: ```qml import QtQuick 2.15 import QtQuick.Controls 2.15 ApplicationWindow { visible: true width: 800 height: 600 Row { anchors.fill: parent spacing: 10 Image { source: "myImage.png" width: parent.width * 0.5 height: parent.height * 0.5 fillMode: Image.PreserveAspectFit } } } ``` Iโve tried using `Image.PreserveAspectFit`, but it still doesnโt seem to respect the bounding rectangle correctly during window resizing. The aspect ratio gets distorted, and the image looks stretched rather than constrained. I also experimented with using `anchors` instead of setting the width and height explicitly, but that did not resolve the scenario either. Additionally, I noticed in the console log that there are warnings about the image loading state, such as `Image: Unable to assign to property "width": Image is not loaded`. This seems to happen when the layout adjusts during a resize event. Has anyone experienced similar behavior or can suggest a workaround to ensure that my image scales correctly and maintains its aspect ratio in a responsive layout? Any help would be greatly appreciated! For reference, this is a production web app. What's the correct way to implement this? I appreciate any insights! This is part of a larger microservice I'm building. What are your experiences with this?