Unable to assign QQuickRootItem to double

2021. 7. 31. 06:39Programming/Qt

반응형

Qt Quick 프로그래밍을 하던 중에 이런 오류가 나왔다.

찾아보니 Rectangle의 width와 height 값을 Window에서 parent로 값을 가져오려고 해서 나오는 오류였다.

Window {
    width: 640
    height: 480
    visible: true

    Rectangle {
        id: rect
        width: parent
        height: parent
    }
}

해결 방법은 여러가지이다.

  1. anchors.fill : parent 를 대신 사용한다.
  2. window에 id 값을 지정해서 id.width 값과 id. height 값을 받는다.

참고

https://stackoverflow.com/questions/30121552/qml-unable-to-assign-qquickitem-to-qquickanchorline

 

QML: Unable to assign QQuickItem to QQuickAnchorLine

I'm trying to position item with id containerItem in main window with id mainWindow in the main.qml file. But I've got this message in output: Unable to assign QQuickWindowQmlImpl to QQuickItem...

stackoverflow.com

 

반응형

'Programming > Qt' 카테고리의 다른 글

qml ChartView zoom in rect  (0) 2022.03.08
QML module not found 해결법  (0) 2021.12.20
QQuickView does not support using a window as a root item.  (0) 2021.07.24
Error while building/deploying project  (0) 2021.07.22
Qt Quick이란?  (0) 2021.07.21