【问题标题】:Qt ColumnLayout full screenQt ColumnLayout 全屏
【发布时间】:2018-09-14 04:06:03
【问题描述】:

Qt:5.11.1
操作系统:Windows 10 64 位

这是 Qt Quick 应用程序。当窗口处于全屏模式时。布局变得奇怪。我认为这是之前尺寸的残像。

启动

全屏

import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3

Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")

ColumnLayout{
    spacing: 2
    anchors.fill: parent

    Rectangle {
        Layout.alignment: Qt.AlignCenter
        color: "red"
        Layout.preferredWidth: 40
        Layout.preferredHeight: 40
    }

    Rectangle {
        Layout.alignment: Qt.AlignRight
        color: "green"
        Layout.preferredWidth: 40
        Layout.preferredHeight: 70
    }

    Rectangle {
        Layout.alignment: Qt.AlignBottom
        Layout.fillHeight: true
        color: "blue"
        Layout.preferredWidth: 70
        Layout.preferredHeight: 40
    }

    Rectangle {
        Layout.alignment: Qt.AlignBottom
        Layout.fillHeight: true
        color: "orange"
        Layout.preferredWidth: 70
        Layout.preferredHeight: 40
    }
}
}

【问题讨论】:

标签: qt qml


【解决方案1】:

不是答案,而是问题的简化

import QtQuick 2.11
import QtQuick.Window 2.11

Window {
    visible: true
    width: 640
    height: 480

    // Works with any Item
    Rectangle {
        anchors.centerIn: parent
        color: "red"
        width: 40
        height: 40
    }

}

如何重现

  • 在 Windows 10 上,单击窗口的最大化按钮
  • 上一帧未清除

可能与https://bugreports.qt.io/browse/QTBUG-54451相关

创建了新的错误https://bugreports.qt.io/browse/QTBUG-70570

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-07
    • 2012-09-02
    • 1970-01-01
    • 1970-01-01
    • 2014-10-05
    • 2013-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多