|  | Home · All Classes · Modules

# QDesignerPropertyEditorInterface Class Reference
[QtDesigner module]

The QDesignerPropertyEditorInterface class allows you to query and manipulate the current state of Qt Designer's property editor. More...

Inherits QWidget.

### Methods

- __init__ (self, QWidget parent, Qt.WindowFlags flags = 0)
- QDesignerFormEditorInterface core (self)
- QString currentPropertyName (self)
- bool isReadOnly (self)
- QObject object (self)
- setObject (self, QObject object)
- setPropertyValue (self, QString name, QVariant value, bool changed = True)
- setReadOnly (self, bool readOnly)

### Qt Signals

- void propertyChanged (const QString&,const QVariant&)

## Detailed Description

The QDesignerPropertyEditorInterface class allows you to query and manipulate the current state of Qt Designer's property editor.

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, propertyChanged(), which is emitted whenever a property changes in the property editor. The signal's arguments are the property that changed and its new value.

For example, when implementing a custom widget plugin, you can connect the signal to a custom slot:

             QDesignerPropertyEditorInterface *propertyEditor = 0;
             propertyEditor = formEditor->propertyEditor();

             connect(propertyEditor, SIGNAL(propertyChanged(QString, QVariant)),
                     this, SLOT(checkProperty(QString, QVariant)));

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:

             void checkProperty(QString property, QVariant value) {
                 QDesignerPropertyEditorInterface *propertyEditor = 0;
                 propertyEditor = formEditor->propertyEditor();

                 QObject *object = propertyeditor->object();
                 MyCustomWidget *widget = qobject_cast<MyCustomWidget>(object);

                 if (widget && property == aProperty && value != expectedValue)
                     {...}
             }

The QDesignerPropertyEditorInterface class is not intended to be instantiated directly. You can retrieve an interface to Qt Designer's property editor using the QDesignerFormEditorInterface.propertyEditor() function. A pointer to Qt Designer's current QDesignerFormEditorInterface object (`formEditor` in the examples above) is provided by the QDesignerCustomWidgetInterface.initialize() function's parameter. When implementing a custom widget plugin, you must subclass the QDesignerCustomWidgetInterface to expose your plugin to Qt Designer.

The functions accessing the property editor are the core() function that you can use to retrieve an interface to the form editor, the currentPropertyName() function that returns the name of the currently selected property in the property editor, the object() function that returns the currently selected object in Qt Designer's workspace, and the isReadOnly() function that returns true if the property editor is write proteced (otherwise false).

The slots manipulating the property editor's state are the setObject() slot that you can use to change the currently selected object in Qt Designer's workspace, the setPropertyValue() slot that changes the value of a given property and the setReadOnly() slot that control the write protection of the property editor.

See also QDesignerFormEditorInterface.

## Method Documentation

### QDesignerPropertyEditorInterface.__init__ (self, QWidget parent, Qt.WindowFlags flags = 0)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a property editor interface with the given parent and the specified window flags.

### QDesignerFormEditorInterface QDesignerPropertyEditorInterface.core (self)

Returns a pointer to Qt Designer's current QDesignerFormEditorInterface object.

### QString QDesignerPropertyEditorInterface.currentPropertyName (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the name of the currently selected property in the property editor.

See also setPropertyValue().

### bool QDesignerPropertyEditorInterface.isReadOnly (self)

This method is abstract and should be reimplemented in any sub-class.

Returns true if the property editor is write protected; otherwise false.

See also setReadOnly().

### QObject QDesignerPropertyEditorInterface.object (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the currently selected object in Qt Designer's workspace.

See also setObject().

### QDesignerPropertyEditorInterface.setObject (self, QObject object)

This method is also a Qt slot with the C++ signature `void setObject(QObject *)`.

This method is abstract and should be reimplemented in any sub-class.

Changes the currently selected object in Qt Designer's workspace, to object.

See also object().

### QDesignerPropertyEditorInterface.setPropertyValue (self, QString name, QVariant value, bool changed = True)

This method is also a Qt slot with the C++ signature `void setPropertyValue(const QString&,const QVariant&,bool = 1)`.

This method is abstract and should be reimplemented in any sub-class.

Sets the value of the property specified by name to value.

In addition, the property is marked as changed in the property editor, i.e. its value is different from the default value.

See also currentPropertyName() and propertyChanged().

### QDesignerPropertyEditorInterface.setReadOnly (self, bool readOnly)

This method is also a Qt slot with the C++ signature `void setReadOnly(bool)`.

This method is abstract and should be reimplemented in any sub-class.

If readOnly is true, the property editor is made write protected; otherwise the write protection is removed.

See also isReadOnly().

## Qt Signal Documentation

### void propertyChanged (const QString&,const QVariant&)

This is the default overload of this signal.

This signal is emitted whenever a property changes in the property editor. The property that changed and its new value are specified by name and value respectively.

See also setPropertyValue().