0
QMLに関する面白い問題。デフォルトのQt Quickアプリケーションを作成して実行すると、黒い画面が表示されます。ウィンドウやその他のアイテムはレンダリングされません。しかし、それを最小化して再び元の状態に戻すと、アイテムがレンダリングされます。誰もこの種の問題について知っていますか? Before minimizing After minimizingQML項目がレンダリングされない
import QtQuick 2.5
import QtQuick.Window 2.2
Window {
visible: true
width: 500
height: 500
Rectangle {
id: test
width: 300
height: 200
color: "red"
border.color: "black"
border.width: 4
}
Rectangle {
width: test.width/2
height: test.height/2
color: "red"
border.color: "black"
border.width: 4
anchors.centerIn: parent
Rectangle {
width: parent.width/2
height: parent.height/2
radius: width * 0.5
//x: 200
//y: 200
color: "green"
border.color: "darkgreen"
border.width: 4
anchors.left: parent.left
anchors.bottom: parent.bottom
}
}
}
期待通りに動作します(Windows 8/Qt 5.6)。おそらくそれはグラフィックスカードまたはVM/OpenGLの問題です。 – folibis
問題のあるグラフィックカードとQt Quickでの私の経験から、この似たようなフラグを使ってアプリケーションをテストすることをお勧めします: 'QGuiApplication :: setAttribute(Qt :: AA_UseOpenGLES);' QMLをロードする前にC++で設定してください。 –