QDeclarativeParserStatus Class Reference

[QtDeclarative module]

该QDeclarativeParserStatus类提供的QML解析器的状态更新。More…

通过继承QDeclarativeItem

Methods

  • __init__ (self)
  • __init__ (self, QDeclarativeParserStatus)
  • classBegin (self)
  • componentComplete (self)

Detailed Description

该QDeclarativeParserStatus类提供的QML解析器的状态更新。

QDeclarativeParserStatus提供了一种机制,用于通过一个实例化的类QDeclarativeEngine要在他们的创作关键点收到通知。

这个类通常用于优化的目的,因为它可以让你推迟昂贵的操作后,所有的属性都被设置在对象上,直到。例如, QML的Text元素使用的解析器状态推迟文字排版,直到所有的属性都被设置(我们不希望布局时,text被分配,然后重新布局时font分配和重新布局时再width被分配,等等) 。

要使用QDeclarativeParserStatus ,你必须同时继承一个QObject派生类和QDeclarativeParserStatus ,并使用Q_INTERFACES()宏。

  1. class MyObject : public [QObject]($docs-qobject.html), public QDeclarativeParserStatus
  2. {
  3. Q_OBJECT
  4. Q_INTERFACES(QDeclarativeParserStatus)
  5. public:
  6. MyObject([QObject]($docs-qobject.html) *parent = 0);
  7. ...
  8. void classBegin();
  9. void componentComplete();
  10. }

Method Documentation

  1. QDeclarativeParserStatus.__init__ (self)
  1. QDeclarativeParserStatus.__init__ (self, QDeclarativeParserStatus)
  1. QDeclarativeParserStatus.classBegin (self)

这种方法是抽象的,应在任何子类中重新实现。

类创建后调用,但任何属性已设定之前。

  1. QDeclarativeParserStatus.componentComplete (self)

这种方法是抽象的,应在任何子类中重新实现。

导致此实例已建设完成的根组件后调用。在这一点上所有的静态值和绑定值已被分配给类。