代码之家  ›  专栏  ›  技术社区  ›  Piotr Smaroń

CircularGauge父引用错误

  •  0
  • Piotr Smaroń  · 技术社区  · 7 年前

    退出在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
        }
    }
    

    If线

    anchors.centerIn: root
    

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

    parent:root
    

    在仪表中没有帮助。知道是什么原因吗?

    2 回复  |  直到 7 年前
        1
  •  0
  •   KernelPanic    7 年前

    设置 anchors.centerIn: parent 相反,如果 anchors.centerIn: root

        2
  •  0
  •   Piotr Smaroń    7 年前

    我使用的是桌面Qt 5.10.0 MinGW 32位。当更改为v5.8时,应用程序将无误退出,这对我来说已经足够了。