0

退出在 Qt 下开发的应用程序时,出现以下错误:

file:///C:/Qt/5.10.0/mingw53_32/qml/QtQuick/Controls/Private/Control.qml:90:
ReferenceError: parent is not defined

从组件定义如下:

import QtQuick 2.8
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Extras 1.4

Item {
    id:root

    CircularGauge {
        anchors.centerIn: root
    }
}

如果线

anchors.centerIn: root

被删除,则没有错误。我很确定每当 CircularGauge 以某种方式引用父级时都会产生错误,尽管设置

parent:root

在仪表上没有帮助。知道是什么原因造成的吗?

4

2 回答 2

0

anchors.centerIn: parent改为设置if anchors.centerIn: root

于 2018-03-09T10:27:22.307 回答
0

我使用的是 Desktop Qt 5.10.0 MinGW 32bit。当更改为 v5.8 时,应用程序退出时不会出错,这对我来说已经足够了。

于 2018-03-12T08:29:40.680 回答