Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 1971

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QDesignerPropertySheetExtensionInterface" doc="/**
&lt;p&gt;The &lt;a href=&quot;QDesignerPropertySheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerPropertySheetExtension&lt;/tt&gt;&lt;/a&gt; class allows you to manipulate a widget's properties which is displayed in Qt Designer's property editor.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QDesignerPropertySheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerPropertySheetExtension&lt;/tt&gt;&lt;/a&gt; provides a collection of functions that are typically used to query a widget's properties, and to manipulate the properties' appearance in the property editor. For example:&lt;/p&gt;
&lt;pre&gt;    QDesignerPropertySheetExtension *propertySheet  = 0;
    QExtensionManager manager = formEditor-&amp;gt;extensionManager();

    propertySheet = qt_extension&amp;lt;QDesignerPropertySheetExtension*&amp;gt;(manager, widget);
    int index = propertySheet-&amp;gt;indexOf(QLatin1String(&amp;quot;margin&amp;quot;));

    propertySheet-&amp;gt;setProperty(index, 10);
    propertySheet-&amp;gt;setChanged(index, true);

    delete propertySheet;&lt;/pre&gt;
&lt;p&gt;Note that if you change the value of a property using the QDesignerPropertySheetExtension::setProperty() function, the undo stack is not updated. To ensure that a property's value can be reverted using the undo stack, you must use the QDesignerFormWindowCursorInterface::setProperty() function, or its buddy setWidgetProperty(), instead.&lt;/p&gt;
&lt;p&gt;When implementing a custom widget plugin, a pointer to &lt;i&gt;Qt Designer&lt;/i&gt;'s current QDesignerFormEditorInterface object (&lt;tt&gt;formEditor&lt;/tt&gt; in the example above) is provided by the QDesignerCustomWidgetInterface::initialize() function's parameter.&lt;/p&gt;
&lt;p&gt;The property sheet, or any other extension, can be retrieved by querying &lt;i&gt;Qt Designer&lt;/i&gt;'s extension manager using the qt_extension() function. When you want to release the extension, you only need to delete the pointer.&lt;/p&gt;
&lt;p&gt;All widgets have a default property sheet which populates &lt;i&gt;Qt Designer&lt;/i&gt;'s property editor with the widget's properties (i.e the ones defined with the Q_PROPERTY() macro). But &lt;a href=&quot;QDesignerPropertySheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerPropertySheetExtension&lt;/tt&gt;&lt;/a&gt; also provides an interface for creating custom property sheet extensions.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Warning:&lt;/b&gt; &lt;i&gt;Qt Designer&lt;/i&gt; uses the &lt;a href=&quot;QDesignerPropertySheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerPropertySheetExtension&lt;/tt&gt;&lt;/a&gt; to feed its property editor. Whenever a widget is selected in its workspace, &lt;i&gt;Qt Designer&lt;/i&gt; will query for the widget's property sheet extension. If the selected widget has an implemented property sheet extension, this extension will override the default property sheet.&lt;/p&gt;
&lt;p&gt;To create a property sheet extension, your extension class must inherit from both &lt;a href=&quot;%2E%2E/%2E%2E/qt/core/QObject.html&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QDesignerPropertySheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerPropertySheetExtension&lt;/tt&gt;&lt;/a&gt;. Then, since we are implementing an interface, we must ensure that it's made known to the meta object system using the Q_INTERFACES() macro:&lt;/p&gt;
&lt;pre&gt;    class MyPropertySheetExtension : public QObject,
            public QDesignerPropertySheetExtension
    {
        Q_OBJECT
        Q_INTERFACES(QDesignerPropertySheetExtension)

    public:
        ...
    }&lt;/pre&gt;
&lt;p&gt;This enables &lt;i&gt;Qt Designer&lt;/i&gt; to use qobject_cast() to query for supported interfaces using nothing but a &lt;a href=&quot;%2E%2E/%2E%2E/qt/core/QObject.html&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; pointer.&lt;/p&gt;
&lt;p&gt;In &lt;i&gt;Qt Designer&lt;/i&gt; the extensions are not created until they are required. For that reason, when implementing a property sheet extension, you must also create a QExtensionFactory, i.e a class that is able to make an instance of your extension, and register it using &lt;i&gt;Qt Designer&lt;/i&gt;'s extension manager&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;When a property sheet extension is required, &lt;i&gt;Qt Designer&lt;/i&gt;'s extension manager&lt;/tt&gt; will run through all its registered factories calling QExtensionFactory::createExtension() for each until the first one that is able to create a property sheet extension for the selected widget, is found. This factory will then make an instance of the extension. If no such factory can be found, &lt;i&gt;Qt Designer&lt;/i&gt; will use the default property sheet.&lt;/p&gt;
&lt;p&gt;There are four available types of extensions in &lt;i&gt;Qt Designer&lt;/i&gt;: QDesignerContainerExtension, &lt;a href=&quot;QDesignerMemberSheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerMemberSheetExtension&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QDesignerPropertySheetExtension.html&quot;&gt;&lt;tt&gt;QDesignerPropertySheetExtension&lt;/tt&gt;&lt;/a&gt; and QDesignerTaskMenuExtension. Qt Designer's behavior is the same whether the requested extension is associated with a multi page container, a member sheet, a property sheet or a task menu.&lt;/p&gt;
&lt;p&gt;The QExtensionFactory class provides a standard extension factory, and can also be used as an interface for custom extension factories. You can either create a new QExtensionFactory and reimplement the QExtensionFactory::createExtension() function. For example:&lt;/p&gt;
&lt;pre&gt;     QObject *ANewExtensionFactory::createExtension(QObject *object,
             const QString &amp;amp;iid, QObject *parent) const
     {
         if (iid != Q_TYPEID(QDesignerPropertySheetExtension))
             return 0;

         if (MyCustomWidget *widget = qobject_cast&amp;lt;MyCustomWidget*&amp;gt;
                (object))
             return new MyPropertySheetExtension(widget, parent);

         return 0;
     }&lt;/pre&gt;
&lt;p&gt;Or you can use an existing factory, expanding the QExtensionFactory::createExtension() function to make the factory able to create a property sheet extension extension as well. For example:&lt;/p&gt;
&lt;pre&gt;     QObject *AGeneralExtensionFactory::createExtension(QObject *object,
             const QString &amp;amp;iid, QObject *parent) const
     {
         MyCustomWidget *widget = qobject_cast&amp;lt;MyCustomWidget*&amp;gt;(object);

         if (widget &amp;amp;&amp;amp; (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
             return new MyTaskMenuExtension(widget, parent);

         } else if (widget &amp;amp;&amp;amp; (iid == Q_TYPEID(QDesignerPropertySheetExtension))) {
             return new MyPropertySheetExtension(widget, parent);

         } else {
             return 0;
         }
     }&lt;/pre&gt;
&lt;p&gt;For a complete example using an extension class, see the Task Menu Extension example&lt;/tt&gt;. The example shows how to create a custom widget plugin for Qt Designer, and how to to use the QDesignerTaskMenuExtension class to add custom items to &lt;i&gt;Qt Designer&lt;/i&gt;'s task menu.&lt;/p&gt;

@see &lt;tt&gt;QDesignerDynamicPropertySheetExtension&lt;/tt&gt;
@see &lt;tt&gt;QExtensionFactory&lt;/tt&gt;
@see &lt;tt&gt;QExtensionManager&lt;/tt&gt;
@see &lt;a href=&quot;%2E%2E/%2E%2E/qt/designer-creating-custom-widgets-extensions.html&quot;&gt;Creating Custom Widget Extensions&lt;/tt&gt;&lt;/a&gt; */">
    <method name="public int count()" doc="/**
&lt;p&gt;Returns the selected widget's number of properties.&lt;/p&gt;
 */"/>
    <method name="public boolean hasReset(int index)" doc="/**
&lt;p&gt;Returns true if the property at the given &lt;tt&gt;index&lt;/tt&gt; has a reset button in &lt;i&gt;Qt Designer&lt;/i&gt;'s property editor, otherwise false.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#reset(int)&quot;&gt;&lt;tt&gt;reset&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public int indexOf(java.lang.String name)" doc="/**
&lt;p&gt;Returns the index for a given property &lt;tt&gt;name&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#propertyName(int)&quot;&gt;&lt;tt&gt;propertyName&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean isAttribute(int index)" doc="/**
&lt;p&gt;Returns true if the property at the given &lt;tt&gt;index&lt;/tt&gt; is an attribute, which will be &lt;i&gt;excluded&lt;/i&gt; from the .ui file, otherwise false.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#setAttribute(int, boolean)&quot;&gt;&lt;tt&gt;setAttribute&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean isChanged(int index)" doc="/**
&lt;p&gt;Returns true if the value of the property at the given &lt;tt&gt;index&lt;/tt&gt; differs from the property's default value, otherwise false.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#setChanged(int, boolean)&quot;&gt;&lt;tt&gt;setChanged&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#reset(int)&quot;&gt;&lt;tt&gt;reset&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean isVisible(int index)" doc="/**
&lt;p&gt;Returns true if the property at the given &lt;tt&gt;index&lt;/tt&gt; is visible in &lt;i&gt;Qt Designer&lt;/i&gt;'s property editor, otherwise false.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#setVisible(int, boolean)&quot;&gt;&lt;tt&gt;setVisible&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public java.lang.Object property(int index)" doc="/**
&lt;p&gt;Returns the value of the property at the given &lt;tt&gt;index&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#setProperty(int, java.lang.Object)&quot;&gt;&lt;tt&gt;setProperty&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#propertyGroup(int)&quot;&gt;&lt;tt&gt;propertyGroup&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public java.lang.String propertyGroup(int index)" doc="/**
&lt;p&gt;Returns the property group for the property at the given &lt;tt&gt;index&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Qt Designer&lt;/i&gt;'s property editor supports property groups, i.e&amp;#x2e; sections of related properties. A property can be related to a group using the &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#setPropertyGroup(int, java.lang.String)&quot;&gt;&lt;tt&gt;setPropertyGroup&lt;/tt&gt;&lt;/a&gt; function. The default group of any property is the name of the class that defines it. For example, the QObject::objectName property appears within the &lt;a href=&quot;%2E%2E/%2E%2E/qt/core/QObject.html&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; property group.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#setPropertyGroup(int, java.lang.String)&quot;&gt;&lt;tt&gt;setPropertyGroup&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public java.lang.String propertyName(int index)" doc="/**
&lt;p&gt;Returns the name of the property at the given &lt;tt&gt;index&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean reset(int index)" doc="/**
&lt;p&gt;Resets the value of the property at the given &lt;tt&gt;index&lt;/tt&gt;, to the default value. Returns true if a default value could be found, otherwise false.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#hasReset(int)&quot;&gt;&lt;tt&gt;hasReset&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#isChanged(int)&quot;&gt;&lt;tt&gt;isChanged&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setAttribute(int index, boolean b)" doc="/**
&lt;p&gt;If &lt;tt&gt;b&lt;/tt&gt; is true, the property at the given &lt;tt&gt;index&lt;/tt&gt; is made an attribute which will be &lt;i&gt;excluded&lt;/i&gt; from the .ui file; otherwise it will be included.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#isAttribute(int)&quot;&gt;&lt;tt&gt;isAttribute&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setChanged(int index, boolean changed)" doc="/**
&lt;p&gt;Sets whether the property at the given &lt;tt&gt;index&lt;/tt&gt; is different from its default value, or not, depending on the &lt;tt&gt;changed&lt;/tt&gt; parameter.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#isChanged(int)&quot;&gt;&lt;tt&gt;isChanged&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setProperty(int index, java.lang.Object value)" doc="/**
&lt;p&gt;Sets the &lt;tt&gt;value&lt;/tt&gt; of the property at the given &lt;tt&gt;index&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Warning:&lt;/b&gt; If you change the value of a property using this function, the undo stack is not updated. To ensure that a property's value can be reverted using the undo stack, you must use the QDesignerFormWindowCursorInterface::setProperty() function, or its buddy setWidgetProperty(), instead.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#property(int)&quot;&gt;&lt;tt&gt;property&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#propertyGroup(int)&quot;&gt;&lt;tt&gt;propertyGroup&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setPropertyGroup(int index, java.lang.String group)" doc="/**
&lt;p&gt;Sets the property group for the property at the given &lt;tt&gt;index&lt;/tt&gt; to &lt;tt&gt;group&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;Relating a property to a group makes it appear within that group's section in the property editor. The default property group of any property is the name of the class that defines it. For example, the QObject::objectName property appears within the &lt;a href=&quot;%2E%2E/%2E%2E/qt/core/QObject.html&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; property group.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#property(int)&quot;&gt;&lt;tt&gt;property&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#propertyGroup(int)&quot;&gt;&lt;tt&gt;propertyGroup&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setVisible(int index, boolean b)" doc="/**
&lt;p&gt;If &lt;tt&gt;b&lt;/tt&gt; is true, the property at the given &lt;tt&gt;index&lt;/tt&gt; is visible in &lt;i&gt;Qt Designer&lt;/i&gt;'s property editor; otherwise the property is hidden.&lt;/p&gt;

@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#indexOf(java.lang.String)&quot;&gt;&lt;tt&gt;indexOf&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDesignerPropertySheetExtensionInterface.html#isVisible(int)&quot;&gt;&lt;tt&gt;isVisible&lt;/tt&gt;&lt;/a&gt; */"/>
</class>