<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ML Window&#x2F;Item Resize Bug: Anchors&#x2F;Layout not adjusting correctly on window resize]]></title><description><![CDATA[<p dir="auto">When I manually resize the application window, the main Item (or Rectangle) inside the Window does not resize immediately/properly. There is a large blank space, and the internal elements (like the calculator buttons in the video) don't re-center or refill the parent as expected.<br />
this is the code<br />
import QtQuick 2.15<br />
import QtQuick.Controls 2.15<br />
import QtQuick.Layouts 1.15<br />
import QtQuick.Window 2.15</p>
<p dir="auto">Window {<br />
id: win<br />
visible: true<br />
width: 440<br />
height: 720<br />
minimumWidth: 360<br />
minimumHeight: 540<br />
color: "transparent"<br />
flags: Qt.FramelessWindowHint | Qt.Window</p>
<pre><code>readonly property bool isMax: win.visibility === Window.Maximized

// Define the required gap size for the invisible resize handle
property int resizePad: 12

QtObject {
    id: theme
    property color background: "#0f172a"
    property color titleBarBg: "#081024"
    property color border: "#1f2937"
    property color accent: "#06b6d4"
    property color textMain: "#e6eef8"
    property color textSec: "#94a3b8"
}

// -------------------- 1) MANUAL RESIZE LAYER (Covers the full Window) --------------------
Item {
    id: resizeLayer
    anchors.fill: parent
    z: 9999
    visible: !isMax

    property int edge: win.resizePad      // 12px area for edges
    property int corner: win.resizePad * 2 // 24px area for corners (easier to grab)

    // Top Edge
    MouseArea {
        anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top
        height: resizeLayer.edge
        cursorShape: Qt.SizeVerCursor
        onPressed: win.startSystemResize(Qt.TopEdge)
    }
    // Bottom Edge
    MouseArea {
        anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom
        height: resizeLayer.edge
        cursorShape: Qt.SizeVerCursor
        onPressed: win.startSystemResize(Qt.BottomEdge)
    }
    // Left Edge
    MouseArea {
        anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom
        width: resizeLayer.edge
        cursorShape: Qt.SizeHorCursor
        onPressed: win.startSystemResize(Qt.LeftEdge)
    }
    // Right Edge
    MouseArea {
        anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: parent.bottom
        width: resizeLayer.edge
        cursorShape: Qt.SizeHorCursor
        onPressed: win.startSystemResize(Qt.RightEdge)
    }

    // Corners (use larger corner area size)
    MouseArea {
        width: resizeLayer.corner; height: resizeLayer.corner
        anchors.left: parent.left; anchors.top: parent.top
        cursorShape: Qt.SizeFDiagCursor
        onPressed: win.startSystemResize(Qt.LeftEdge | Qt.TopEdge)
    }
    MouseArea {
        width: resizeLayer.corner; height: resizeLayer.corner
        anchors.right: parent.right; anchors.top: parent.top
        cursorShape: Qt.SizeBDiagCursor
        onPressed: win.startSystemResize(Qt.RightEdge | Qt.TopEdge)
    }
    MouseArea {
        width: resizeLayer.corner; height: resizeLayer.corner
        anchors.left: parent.left; anchors.bottom: parent.bottom
        cursorShape: Qt.SizeBDiagCursor
        onPressed: win.startSystemResize(Qt.LeftEdge | Qt.BottomEdge)
    }
    MouseArea {
        width: resizeLayer.corner; height: resizeLayer.corner
        anchors.right: parent.right; anchors.bottom: parent.bottom
        cursorShape: Qt.SizeFDiagCursor
        onPressed: win.startSystemResize(Qt.RightEdge | Qt.BottomEdge)
    }
}

// -------------------- 2) MAIN UI (SHRUNK TO EXPOSE RESIZE LAYER) --------------------
Rectangle {
    id: inner
    anchors.fill: parent
    // THE FIX: Shrink the UI rectangle to expose the transparent area beneath it
    anchors.margins: isMax ? 0 : win.resizePad

    radius: isMax ? 0 : 16
    color: theme.background
    border.width: 1
    border.color: theme.border
    clip: true

    // Titlebar
    Rectangle {
        id: titleBar
        width: parent.width
        height: 48
        color: theme.titleBarBg

        MouseArea {
            anchors.fill: parent
            anchors.rightMargin: 120
            onPressed: win.startSystemMove()
            onDoubleClicked: isMax ? win.showNormal() : win.showMaximized()
        }

        // Title
        Row {
            anchors.left: parent.left; anchors.leftMargin: 16; anchors.verticalCenter: parent.verticalCenter; spacing: 8
            Rectangle { width: 10; height: 10; radius: 3; rotation: 45; color: theme.accent }
            Text { text: "LUMINA CALC"; font.pixelSize: 12; font.bold: true; color: theme.textSec }
        }

        // Window buttons
        Row {
            anchors.right: parent.right; anchors.rightMargin: 10; anchors.verticalCenter: parent.verticalCenter; spacing: 6
            WindowBtn { symbol: "─"; onClicked: win.showMinimized() }
            WindowBtn { symbol: isMax ? "❐" : "□"; onClicked: isMax ? win.showNormal() : win.showMaximized() }
            WindowBtn { symbol: "✕"; isDestructive: true; onClicked: Qt.quit() }
        }
    }
}

// -------------------- COMPONENT: WindowBtn --------------------
component WindowBtn : Rectangle {
    property string symbol: ""
    property bool isDestructive: false
    signal clicked()

    width: 32; height: 30; radius: 6
    color: wMa.containsMouse ? (isDestructive ? "#e11d48" : "#1f2937") : "transparent"

    Text {
        anchors.centerIn: parent
        text: symbol
        color: isDestructive &amp;&amp; wMa.containsMouse ? "#fff" : theme.textSec
        font.pixelSize: 12
    }

    MouseArea {
        id: wMa
        anchors.fill: parent
        hoverEnabled: true
        onClicked: parent.clicked()
    }
}
</code></pre>
<p dir="auto">}</p>
]]></description><link>https://forum.qt.io/topic/163921/ml-window-item-resize-bug-anchors-layout-not-adjusting-correctly-on-window-resize</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 11:22:34 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/163921.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Dec 2025 19:10:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ML Window&#x2F;Item Resize Bug: Anchors&#x2F;Layout not adjusting correctly on window resize on Wed, 17 Dec 2025 20:20:24 GMT]]></title><description><![CDATA[<p dir="auto">What kind of graphics card do you have ?</p>
]]></description><link>https://forum.qt.io/post/834720</link><guid isPermaLink="true">https://forum.qt.io/post/834720</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 17 Dec 2025 20:20:24 GMT</pubDate></item><item><title><![CDATA[Reply to ML Window&#x2F;Item Resize Bug: Anchors&#x2F;Layout not adjusting correctly on window resize on Sat, 13 Dec 2025 17:18:18 GMT]]></title><description><![CDATA[<p dir="auto">Hello!<br />
i tried that but it didn't work</p>
]]></description><link>https://forum.qt.io/post/834599</link><guid isPermaLink="true">https://forum.qt.io/post/834599</guid><dc:creator><![CDATA[Hadi_vafaee]]></dc:creator><pubDate>Sat, 13 Dec 2025 17:18:18 GMT</pubDate></item><item><title><![CDATA[Reply to ML Window&#x2F;Item Resize Bug: Anchors&#x2F;Layout not adjusting correctly on window resize on Sat, 13 Dec 2025 16:26:49 GMT]]></title><description><![CDATA[<p dir="auto">Can you test with a more recent version ? 6.10.1 is the current release at the time of writing.</p>
]]></description><link>https://forum.qt.io/post/834598</link><guid isPermaLink="true">https://forum.qt.io/post/834598</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 13 Dec 2025 16:26:49 GMT</pubDate></item><item><title><![CDATA[Reply to ML Window&#x2F;Item Resize Bug: Anchors&#x2F;Layout not adjusting correctly on window resize on Sat, 13 Dec 2025 15:27:29 GMT]]></title><description><![CDATA[<p dir="auto">I'm using qt 6.8.2 and im working in windows 11</p>
]]></description><link>https://forum.qt.io/post/834597</link><guid isPermaLink="true">https://forum.qt.io/post/834597</guid><dc:creator><![CDATA[Hadi_vafaee]]></dc:creator><pubDate>Sat, 13 Dec 2025 15:27:29 GMT</pubDate></item><item><title><![CDATA[Reply to ML Window&#x2F;Item Resize Bug: Anchors&#x2F;Layout not adjusting correctly on window resize on Fri, 12 Dec 2025 21:07:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">You should also add:</p>
<ul>
<li>which version of Qt you are using</li>
<li>which OS you are running on</li>
<li>if Linux, which distribution, desktop environment and window manager</li>
</ul>
]]></description><link>https://forum.qt.io/post/834584</link><guid isPermaLink="true">https://forum.qt.io/post/834584</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 12 Dec 2025 21:07:31 GMT</pubDate></item></channel></rss>