KDE 4.9 PyKDE API Reference

- KDE's Python API

# DeclarativeWidget Class Reference

`from PyKDE4.plasma import *`

Inherits: QGraphicsWidget → QObject
Namespace: Plasma

## Detailed Description

DeclarativeWidget plasma/declarativewidget.h <Plasma/DeclarativeWidget>

Author:
  Marco Martin <mart@kde.org>

A widget that contains an entire QML context, with its own declarative engine

Plasma.DeclarativeWidget provides a class for conveniently use QML based declarative user interfaces inside Plasma widgets. To one DeclarativeWidget corresponds one QML file (that can eventually include others) tere will be its own QDeclarativeEngine with a single root object, described in the QML file.

## Signals

| finished ()

## Methods

| __init__ (self, QGraphicsWidget parent=0)
QDeclarativeEngine | engine (self)
bool | isInitializationDelayed (self)
QDeclarativeComponent | mainComponent (self)
QString | qmlPath (self)
| resizeEvent (self, QGraphicsSceneResizeEvent event)
QObject | rootObject (self)
QScriptEngine | scriptEngine (self)
| setInitializationDelayed (self, bool delay)
| setQmlPath (self, QString path)

## Signal Documentation

finished | ( |  | ) |

Emitted when the parsing and execution of the QML file is terminated

Signal syntax:
  `QObject.connect(source, SIGNAL("finished()"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QGraphicsWidget | parent=0
| ) |  |  |

Constructs a new DeclarativeWidget

Parameters:

  | parent | the parent of this widget

QDeclarativeEngine engine | ( |  | self ) |

Returns:
  the declarative engine that runs the qml file assigned to this widget.

bool isInitializationDelayed | ( |  | self ) |

Returns:
  true if the initilization of the QML file will be delayed at the end of the event loop

QDeclarativeComponent mainComponent | ( |  | self ) |

Returns:
  the main QDeclarativeComponent of the engine

QString qmlPath | ( |  | self ) |

Returns:
  the absolute path of the current QML file

resizeEvent | ( | self, |
|  | QGraphicsSceneResizeEvent | event
| ) |  |  |

QObject rootObject | ( |  | self ) |

Returns:
  the root object of the declarative object tree

QScriptEngine scriptEngine | ( |  | self ) |

Returns:
  the script engine used by the declarative engine

Since:
  4.7

setInitializationDelayed | ( | self, |
|  | bool | delay
| ) |  |  |

Sets whether the execution of the QML file has to be delayed later in the event loop. It has to be called before setQmlPath(). In this case will be possible to assign new objects in the main engine context before the main component gets initialized. So it will be possible to access it immediately from the QML code.

Parameters:

  | delay | if true the initilization of the QML file will be delayed at the end of the event loop

setQmlPath | ( | self, |
|  | QString | path
| ) |  |  |

Sets the path of the QML file to parse and execute

Parameters:

  | path | the absolute path of a QML file