Created QProperty documentation.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
7431ae12a4
commit
f1bbc25546
2 changed files with 51 additions and 4 deletions
11
doc/_templates/index.html
vendored
11
doc/_templates/index.html
vendored
|
|
@ -16,17 +16,20 @@
|
||||||
<td width="50%">
|
<td width="50%">
|
||||||
<p class="biglink"><a class="biglink" href="{{ pathto("issuesdiff") }}">PyQt Incompatibilities</a><br/>
|
<p class="biglink"><a class="biglink" href="{{ pathto("issuesdiff") }}">PyQt Incompatibilities</a><br/>
|
||||||
<span class="linkdescr">PySide issues and specificities</span></p>
|
<span class="linkdescr">PySide issues and specificities</span></p>
|
||||||
|
<p class="biglink"><a class="biglink" href="{{ pathto("dbus") }}">DBus</a><br/>
|
||||||
|
<span class="linkdescr">DBus integration</span></p>
|
||||||
<p class="biglink"><a class="biglink" href="{{ pathto("howto-build/index") }}">How to build</a><br/>
|
<p class="biglink"><a class="biglink" href="{{ pathto("howto-build/index") }}">How to build</a><br/>
|
||||||
<span class="linkdescr">building compiling and installing PySide</span></p>
|
<span class="linkdescr">building compiling and installing PySide</span></p>
|
||||||
<p class="biglink"><a class="biglink" href="{{ pathto("newsigslot") }}">New-style signal/slot</a><br/>
|
|
||||||
<span class="linkdescr">using the new-style signal/slot scheme</span></p>
|
|
||||||
</td>
|
</td>
|
||||||
<td width="50%">
|
<td width="50%">
|
||||||
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Contents</a><br/>
|
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Contents</a><br/>
|
||||||
<span class="linkdescr">for a complete overview</span></p>
|
<span class="linkdescr">for a complete overview</span></p>
|
||||||
<p class="biglink"><a class="biglink" href="{{ pathto("dbus") }}">DBus</a><br/>
|
|
||||||
<span class="linkdescr">DBus integration</span></p>
|
|
||||||
|
|
||||||
|
<p class="biglink"><a class="biglink" href="{{ pathto("newsigslot") }}">New-style signal/slot</a><br/>
|
||||||
|
<span class="linkdescr">using the new-style signal/slot scheme</span></p>
|
||||||
|
|
||||||
|
<p class="biglink"><a class="biglink" href="{{ pathto("property") }}">Use of QPropery in PySide</a><br/>
|
||||||
|
<span class="linkdescr">QProperty</span></p>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
||||||
44
doc/property.rst
Normal file
44
doc/property.rst
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
Use of QPropery in PySide
|
||||||
|
*************************
|
||||||
|
|
||||||
|
PySide implements the function 'QProperty' which allows to declare properties compatible with QMetaProperties.
|
||||||
|
|
||||||
|
|
||||||
|
Using PySide.QProperty()
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
The QProperty works like Q_PROPERTY macro, and uses the same arguments.
|
||||||
|
|
||||||
|
QProperty(getFunction, [setFunction], [resetFunction], [Designable], [Scriptable], [Stored], [User])
|
||||||
|
|
||||||
|
|
||||||
|
The example below uses QProperty function to export a property in QMetaObject data.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
...
|
||||||
|
clas MyObject(QObject):
|
||||||
|
def getX(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
def setX(self, value):
|
||||||
|
...
|
||||||
|
|
||||||
|
def resetX(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
X = QProperty(getX, setX, resetX, True, True, True, True)
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
The exported property works like native python property on python side. See the example below.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
...
|
||||||
|
o = MyObject()
|
||||||
|
o.X = 10
|
||||||
|
print o.X
|
||||||
|
...
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue