【问题标题】:Dot symbol in "type" field of property definition operator属性定义运算符的“类型”字段中的点符号
【发布时间】:2014-05-02 12:34:56
【问题描述】:

我正在使用 Qt 5.2 和 QtQuick 2.2。 在我的项目中,我有几个模块放置在单独的目录中。我的问题是在定义属性时我不能在 typename 中使用点分隔符。 例如:

MyRect.qml

import QtQuick 2.2

Rectangle {
   id: root
   property color rectColor: "white"

   color: root.rectColor 
}

MyRectInRect.qml

import QtQuick 2.2
import "./" as MyModule

Rectangle {
   id: root

   property MyModule.MyRect innerRect: MyModule.MyRect {  } 
   // ^ error: Unexpected token `.'; Unexpected token `identifier'
}

我已经在手册中搜索了可以解释此行为的内容,但看起来那里没有任何内容。我猜想在属性定义的“类型”字段中不允许使用点符号。但是有什么方法可以明确定义,哪个模块中的哪个组件应该用作类型?因为可能需要声明具有相同类型名但来自不同模块的属性。

【问题讨论】:

    标签: qt qml qt5 qtquick2 qt5.2


    【解决方案1】:

    这是一个已知问题:QTBUG-10822

    【讨论】:

      猜你喜欢
      • 2023-04-09
      • 2021-06-11
      • 2020-10-10
      • 2011-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-30
      相关资源
      最近更新 更多