File: qdesignerpropertyeditorinterface.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (58 lines) | stat: -rw-r--r-- 11,872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;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)</li><li><div class="fn" /><b><a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a></b> (<i>self</i>, QString, QVariant, bool&#160;<i>changed</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qdesignerpropertyeditorinterface.html#setReadOnly">setReadOnly</a></b> (<i>self</i>, bool)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qdesignerpropertyeditorinterface.html#propertyChanged">propertyChanged</a></b> (const QString&amp;,const QVariant&amp;)</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>         QDesignerPropertyEditorInterface *propertyEditor = 0;
         propertyEditor = formEditor-&gt;propertyEditor();

         connect(propertyEditor, SIGNAL(propertyChanged(QString, QVariant)),
                 this, SLOT(checkProperty(QString, QVariant)));</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>         void checkProperty(QString property, QVariant value) {
             QDesignerPropertyEditorInterface *propertyEditor = 0;
             propertyEditor = formEditor-&gt;propertyEditor();

             QObject *object = propertyeditor-&gt;object();
             MyCustomWidget *widget = qobject_cast&lt;MyCustomWidget&gt;(object);

             if (widget &amp;&amp; property == aProperty &amp;&amp; value != expectedValue)
                 {...}
         }</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>
<p>See also <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDesignerPropertyEditorInterface" />QDesignerPropertyEditorInterface.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>QWidget</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>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/~QDesignerPropertyEditorInterface" />
<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>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/currentPropertyName" />
<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>See also <a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/isReadOnly" />
<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>See also <a href="qdesignerpropertyeditorinterface.html#setReadOnly">setReadOnly</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/object" />
<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>See also <a href="qdesignerpropertyeditorinterface.html#setObject">setObject</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/propertyChanged" />
<h3 class="fn"><a name="setObject" />QDesignerPropertyEditorInterface.setObject (<i>self</i>, <a href="qobject.html">QObject</a>)</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>See also <a href="qdesignerpropertyeditorinterface.html#object">object</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/setPropertyValue" />
<h3 class="fn"><a name="setPropertyValue" />QDesignerPropertyEditorInterface.setPropertyValue (<i>self</i>, QString, QVariant, bool&#160;<i>changed</i>&#160;=&#160;True)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPropertyValue(const QString&amp;,const QVariant&amp;,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>See also <a href="qdesignerpropertyeditorinterface.html#currentPropertyName">currentPropertyName</a>() and <a href="qdesignerpropertyeditorinterface.html#propertyChanged">propertyChanged</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/setReadOnly" />
<h3 class="fn"><a name="setReadOnly" />QDesignerPropertyEditorInterface.setReadOnly (<i>self</i>, bool)</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>See also <a href="qdesignerpropertyeditorinterface.html#isReadOnly">isReadOnly</a>().</p>
<p /><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="propertyChanged" />void propertyChanged (const QString&amp;,const QVariant&amp;)</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>See also <a href="qdesignerpropertyeditorinterface.html#setPropertyValue">setPropertyValue</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerPropertyEditorInterface/setObject" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>