QDesignerPropertyEditorInterface Class Reference

[QtDesigner module]

该QDesignerPropertyEditorInterface类允许你查询和操作的Qt设计器的属性编辑器的当前状态。More…

继承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

该QDesignerPropertyEditorInterface类允许你查询和操作的Qt设计器的属性编辑器的当前状态。

QDesignerPropertyEditorInterface包含了通常用于查询的属性编辑器,其当前状态的功能,和几个插槽集合操纵它的状态。该接口还提供了一个信号,propertyChanged( ) ,这是发射时在属性编辑器中的属性更改。该信号的参数是已更改的属性及其新值。

例如,实现一个自定义的widget插件时,你可以将信号连接到一个自定义的槽:

  1. QDesignerPropertyEditorInterface *propertyEditor = 0;
  2. propertyEditor = formEditor->propertyEditor();
  3. connect(propertyEditor, SIGNAL(propertyChanged([QString](qstring.html), [QVariant](qvariant.html))),
  4. this, SLOT(checkProperty([QString](qstring.html), [QVariant](qvariant.html))));

此外,定制的插槽可以检查新值,我们希望在一个指定的属性,属于特定窗口小部件,改变的范围之内:

  1. void checkProperty([QString](qstring.html) property, [QVariant](qvariant.html) value) {
  2. QDesignerPropertyEditorInterface *propertyEditor = 0;
  3. propertyEditor = formEditor->propertyEditor();
  4. [QObject]($docs-qobject.html) *object = propertyeditor->object();
  5. MyCustomWidget *widget = qobject_cast<MyCustomWidget>(object);
  6. if (widget && property == aProperty && value != expectedValue)
  7. {...}
  8. }

该QDesignerPropertyEditorInterface类不适合直接实例化。你可以检索界面Qt Designer使用的属性编辑器QDesignerFormEditorInterface.propertyEditor()函数。一个指向Qt Designer目前的QDesignerFormEditorInterface对象(formEditor在上面的例子)是由提供QDesignerCustomWidgetInterface.initialize( )函数的参数。当实现一个自定义的widget插件,你必须在子类QDesignerCustomWidgetInterface暴露你的插件Qt Designer

访问属性编辑器的功能是core( )函数,你可以使用它来检索一个接口,表单编辑器中,currentPropertyName( )函数,返回的属性编辑器中当前所选属性的名称时,object( )函数,返回当前选定的对象Qt Designer的工作空间,以及isReadOnly( )函数,如果属性编辑器是写proteced返回True (否则返回False ) 。

操纵属性编辑器的状态的槽的setObject()槽,你可以用它来改变当前选定的对象Qt Designer的工作区时,setPropertyValue()槽,改变一个给定属性的值和setReadOnly()槽控制的属性编辑器的写保护。


Method Documentation

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

parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

构造一个属性编辑器界面与给定parent和在指定的窗口flags

  1. QDesignerFormEditorInterface QDesignerPropertyEditorInterface.core (self)

返回一个指针Qt Designer目前的QDesignerFormEditorInterface对象。

  1. QString QDesignerPropertyEditorInterface.currentPropertyName (self)

这种方法是抽象的,应在任何子类中重新实现。

返回在属性编辑器中当前所选属性的名称。

See also setPropertyValue( ) 。

  1. bool QDesignerPropertyEditorInterface.isReadOnly (self)

这种方法是抽象的,应在任何子类中重新实现。

返回True,如果属性编辑器处于写保护状态,否则为False 。

See also setReadOnly( ) 。

  1. QObject QDesignerPropertyEditorInterface.object (self)

[

这种方法是抽象的,应在任何子类中重新实现。

返回当前选定的对象Qt Designer的工作空间。

]($docs-qobject.html)

See also setObject( ) 。

  1. QDesignerPropertyEditorInterface.setObject (self, QObject object)

这种方法也是一个Qt槽与C + +的签名void setObject(QObject *)

这种方法是抽象的,应在任何子类中重新实现。

在更改当前选定的对象Qt Designer的工作空间,以object

See also object( ) 。

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

这种方法也是一个Qt槽与C + +的签名void setPropertyValue(const QString&,const QVariant&,bool = 1)

这种方法是抽象的,应在任何子类中重新实现。

通过设置指定的属性值namevalue

此外,该属性标记为changed在属性编辑器,即它的值从默认值不同。

See also currentPropertyName()和propertyChanged( ) 。

  1. QDesignerPropertyEditorInterface.setReadOnly (self, bool readOnly)

这种方法也是一个Qt槽与C + +的签名void setReadOnly(bool)

这种方法是抽象的,应在任何子类中重新实现。

If readOnly为True,则属性编辑器是由写保护,否则写保护被删除。

See also isReadOnly( ) 。


Qt Signal Documentation

  1. void propertyChanged (const QString&,const QVariant&)

这是该信号的默认超载。

这个信号被发射时在属性编辑器中的属性更改。这改变了其新的价值的财产被指定namevalue分别。

See also setPropertyValue( ) 。