Qt for Python UsingQtProperties

From Qt Wiki
Revision as of 18:01, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

English 한국어

Using Qt Properties in PySide

PySide provides a

Property

function which allows for declaring properties that simultaneously behave both as Qt and Python properties, and have their setters and getters defined as Python functions.

A short example illustrating defining and accessing a Qt property from Python is given below:

The complete specification for PySide’s property system is given in PSEP 103 [web.archive.org].

Properties in QML expressions

If you are using properties of your objects in QML expressions, QML requires the property to be NOTIFYable. This can be done using a simple signal:

Emit the signal when the data changes, and QML will automatically update all expressions depending on the value.

Categories: