<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QDesignerPropertyEditorInterface Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDesignerPropertyEditorInterface Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1><p>The QDesignerPropertyEditorInterface class allows you to query and manipulate the current state of Qt Designer's property editor. <a href="#details">More...</a></p> <p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdesignerpropertyeditorinterface.html#QDesignerPropertyEditorInterface">__init__</a></b> (<i>self</i>, QWidget <i>parent</i>, Qt.WindowFlags <i>flags</i> = 0)</li><li><div class="fn" />QDesignerFormEditorInterface <b><a href="qdesignerpropertyeditorinterface.html#core">core</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdesignerpropertyeditorinterface.html#currentPropertyName">currentPropertyName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdesignerpropertyeditorinterface.html#isReadOnly">isReadOnly</a></b> (<i>self</i>)</li><li><div class="fn" />QObject <b><a href="qdesignerpropertyeditorinterface.html#object">object</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdesignerpropertyeditorinterface.html#setObject">setObject</a></b> (<i>self</i>, QObject <i>object</i>)</li><li><div class="fn" /><b><a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a></b> (<i>self</i>, QString <i>name</i>, QVariant <i>value</i>, bool <i>changed</i> = True)</li><li><div class="fn" /><b><a href="qdesignerpropertyeditorinterface.html#setReadOnly">setReadOnly</a></b> (<i>self</i>, bool <i>readOnly</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qdesignerpropertyeditorinterface.html#propertyChanged">propertyChanged</a></b> (const QString&,const QVariant&)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDesignerPropertyEditorInterface class allows you to query and manipulate the current state of Qt Designer's property editor.</p> <p>QDesignerPropertyEditorInterface contains a collection of functions that is typically used to query the property editor for its current state, and several slots manipulating it's state. The interface also provide a signal, <a href="qdesignerpropertyeditorinterface.html#propertyChanged">propertyChanged</a>(), which is emitted whenever a property changes in the property editor. The signal's arguments are the property that changed and its new value.</p> <p>For example, when implementing a custom widget plugin, you can connect the signal to a custom slot:</p> <pre class="cpp"> <span class="type">QDesignerPropertyEditorInterface</span> <span class="operator">*</span>propertyEditor <span class="operator">=</span> <span class="number">0</span>; propertyEditor <span class="operator">=</span> formEditor<span class="operator">-</span><span class="operator">></span>propertyEditor(); <a href="qobject.html#connect">connect</a>(propertyEditor<span class="operator">,</span> SIGNAL(propertyChanged(<span class="type"><a href="qstring.html">QString</a></span><span class="operator">,</span> <span class="type"><a href="qvariant.html">QVariant</a></span>))<span class="operator">,</span> <span class="keyword">this</span><span class="operator">,</span> SLOT(checkProperty(<span class="type"><a href="qstring.html">QString</a></span><span class="operator">,</span> <span class="type"><a href="qvariant.html">QVariant</a></span>))); </pre> <p>Then the custom slot can check if the new value is within the range we want when a specified property, belonging to a particular widget, changes:</p> <pre class="cpp"> <span class="type">void</span> checkProperty(<span class="type"><a href="qstring.html">QString</a></span> property<span class="operator">,</span> <span class="type"><a href="qvariant.html">QVariant</a></span> value) { <span class="type">QDesignerPropertyEditorInterface</span> <span class="operator">*</span>propertyEditor <span class="operator">=</span> <span class="number">0</span>; propertyEditor <span class="operator">=</span> formEditor<span class="operator">-</span><span class="operator">></span>propertyEditor(); <span class="type"><a href="qobject.html">QObject</a></span> <span class="operator">*</span>object <span class="operator">=</span> propertyeditor<span class="operator">-</span><span class="operator">></span>object(); MyCustomWidget <span class="operator">*</span>widget <span class="operator">=</span> qobject_cast<span class="operator"><</span>MyCustomWidget<span class="operator">></span>(object); <span class="keyword">if</span> (widget <span class="operator">&</span><span class="operator">&</span> property <span class="operator">=</span><span class="operator">=</span> aProperty <span class="operator">&</span><span class="operator">&</span> value <span class="operator">!</span><span class="operator">=</span> expectedValue) {<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>} } </pre> <p>The QDesignerPropertyEditorInterface class is not intended to be instantiated directly. You can retrieve an interface to <i>Qt Designer</i>'s property editor using the <a href="qdesignerformeditorinterface.html#propertyEditor">QDesignerFormEditorInterface.propertyEditor</a>() function. A pointer to <i>Qt Designer</i>'s current <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> object (<tt>formEditor</tt> in the examples above) is provided by the <a href="qdesignercustomwidgetinterface.html#initialize">QDesignerCustomWidgetInterface.initialize</a>() function's parameter. When implementing a custom widget plugin, you must subclass the <a href="qdesignercustomwidgetinterface.html">QDesignerCustomWidgetInterface</a> to expose your plugin to <i>Qt Designer</i>.</p> <p>The functions accessing the property editor are the <a href="qdesignerpropertyeditorinterface.html#core">core</a>() function that you can use to retrieve an interface to the form editor, the <a href="qdesignerpropertyeditorinterface.html#currentPropertyName">currentPropertyName</a>() function that returns the name of the currently selected property in the property editor, the <a href="qdesignerpropertyeditorinterface.html#object">object</a>() function that returns the currently selected object in <i>Qt Designer</i>'s workspace, and the <a href="qdesignerpropertyeditorinterface.html#isReadOnly">isReadOnly</a>() function that returns true if the property editor is write proteced (otherwise false).</p> <p>The slots manipulating the property editor's state are the <a href="qdesignerpropertyeditorinterface.html#setObject">setObject</a>() slot that you can use to change the currently selected object in <i>Qt Designer</i>'s workspace, the <a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a>() slot that changes the value of a given property and the <a href="qdesignerpropertyeditorinterface.html#setReadOnly">setReadOnly</a>() slot that control the write protection of the property editor.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDesignerPropertyEditorInterface" />QDesignerPropertyEditorInterface.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i>, <a href="qt-windowflags.html">Qt.WindowFlags</a> <i>flags</i> = 0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a property editor interface with the given <i>parent</i> and the specified window <i>flags</i>.</p> <h3 class="fn"><a name="core" /><a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> QDesignerPropertyEditorInterface.core (<i>self</i>)</h3><p>Returns a pointer to <i>Qt Designer</i>'s current <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> object.</p> <h3 class="fn"><a name="currentPropertyName" />QString QDesignerPropertyEditorInterface.currentPropertyName (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the name of the currently selected property in the property editor.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a>().</p> <h3 class="fn"><a name="isReadOnly" />bool QDesignerPropertyEditorInterface.isReadOnly (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns true if the property editor is write protected; otherwise false.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#setReadOnly">setReadOnly</a>().</p> <h3 class="fn"><a name="object" /><a href="qobject.html">QObject</a> QDesignerPropertyEditorInterface.object (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the currently selected object in <i>Qt Designer</i>'s workspace.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#setObject">setObject</a>().</p> <h3 class="fn"><a name="setObject" />QDesignerPropertyEditorInterface.setObject (<i>self</i>, <a href="qobject.html">QObject</a> <i>object</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setObject(QObject *)</tt>.</p><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Changes the currently selected object in <i>Qt Designer</i>'s workspace, to <i>object</i>.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#object">object</a>().</p> <h3 class="fn"><a name="setPropertyValue" />QDesignerPropertyEditorInterface.setPropertyValue (<i>self</i>, QString <i>name</i>, QVariant <i>value</i>, bool <i>changed</i> = True)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPropertyValue(const QString&,const QVariant&,bool = 1)</tt>.</p><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Sets the value of the property specified by <i>name</i> to <i>value</i>.</p> <p>In addition, the property is marked as <i>changed</i> in the property editor, i.e. its value is different from the default value.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#currentPropertyName">currentPropertyName</a>() and <a href="qdesignerpropertyeditorinterface.html#propertyChanged">propertyChanged</a>().</p> <h3 class="fn"><a name="setReadOnly" />QDesignerPropertyEditorInterface.setReadOnly (<i>self</i>, bool <i>readOnly</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setReadOnly(bool)</tt>.</p><p>This method is abstract and should be reimplemented in any sub-class.</p><p>If <i>readOnly</i> is true, the property editor is made write protected; otherwise the write protection is removed.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#isReadOnly">isReadOnly</a>().</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="propertyChanged" />void propertyChanged (const QString&,const QVariant&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a property changes in the property editor. The property that changed and its new value are specified by <i>name</i> and <i>value</i> respectively.</p> <p><b>See also</b> <a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>