diff options
Diffstat (limited to 'doc/html/properties.html')
-rw-r--r-- | doc/html/properties.html | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/doc/html/properties.html b/doc/html/properties.html index c40fbaf0f..388fc48b1 100644 --- a/doc/html/properties.html +++ b/doc/html/properties.html @@ -40,9 +40,9 @@ features like <tt>__property</tt> or <tt>[property]</tt>. Our solution works wit <em>any</em> standard C++ compiler on every platform we support. It's based on the meta-object system that also provides object communication through <a href="signalsandslots.html">signals and slots</a>. -<p> The <tt>Q_PROPERTY</tt> macro in a class declaration declares a -property. Properties can only be declared in classes that inherit <a href="ntqobject.html">TQObject</a>. A second macro, <tt>Q_OVERRIDE</tt>, can be used to override some -aspects of an inherited property in a subclass. (See <a href="#override">Q_OVERRIDE</a>.) +<p> The <tt>TQ_PROPERTY</tt> macro in a class declaration declares a +property. Properties can only be declared in classes that inherit <a href="ntqobject.html">TQObject</a>. A second macro, <tt>TQ_OVERRIDE</tt>, can be used to override some +aspects of an inherited property in a subclass. (See <a href="#override">TQ_OVERRIDE</a>.) <p> To the outer world, a property appears to be similar to a data member. But properties have several features that distinguish them from ordinary data members: @@ -100,9 +100,9 @@ functions in use: </pre> <p> The class has a property "priority" that is not yet known to the <a href="metaobjects.html#meta-object">meta object</a> system. In order to make the property known, you must -declare it with the <tt>Q_PROPERTY</tt> macro. The syntax is as follows: +declare it with the <tt>TQ_PROPERTY</tt> macro. The syntax is as follows: <p> <pre> -Q_PROPERTY( type name READ getFunction [WRITE setFunction] +TQ_PROPERTY( type name READ getFunction [WRITE setFunction] [RESET resetFunction] [DESIGNABLE bool] [SCRIPTABLE bool] [STORED bool] ) </pre> @@ -127,14 +127,14 @@ these cases the type must be specified as <a href="ntqvaluelist.html">TQValueLis In the case of <a href="ntqvaluelist.html">TQValueList</a> and <a href="ntqmap.html">TQMap</a> properties the value passes is a <a href="ntqvariant.html">TQVariant</a> whose value is the entire list or map. -<p> Enumeration types are registered with the <tt>Q_ENUMS</tt> macro. Here's the +<p> Enumeration types are registered with the <tt>TQ_ENUMS</tt> macro. Here's the final class declaration including the property related declarations: <p> <pre> class MyClass : public <a href="ntqobject.html">TQObject</a> { TQ_OBJECT - Q_PROPERTY( Priority priority READ priority WRITE setPriority ) - Q_ENUMS( Priority ) + TQ_PROPERTY( Priority priority READ priority WRITE setPriority ) + TQ_ENUMS( Priority ) public: MyClass( <a href="ntqobject.html">TQObject</a> * parent=0, const char * name=0 ); ~MyClass(); @@ -145,12 +145,12 @@ final class declaration including the property related declarations: }; </pre> -<p> Another similar macro is <tt>Q_SETS</tt>. Like <tt>Q_ENUMS</tt>, it registers an +<p> Another similar macro is <tt>TQ_SETS</tt>. Like <tt>TQ_ENUMS</tt>, it registers an enumeration type but marks it in addition as a "set", i.e. the enumeration values can be OR-ed together. An I/O class might have enumeration values "Read" and "Write" and accept "Read|Write": such an -enum is best handled with <tt>Q_SETS</tt>, rather than <tt>Q_ENUMS</tt>. -<p> The remaining keywords in the <tt>Q_PROPERTY</tt> section are <tt>RESET</tt>, <tt>DESIGNABLE</tt>, <tt>SCRIPTABLE</tt> and <tt>STORED</tt>. +enum is best handled with <tt>TQ_SETS</tt>, rather than <tt>TQ_ENUMS</tt>. +<p> The remaining keywords in the <tt>TQ_PROPERTY</tt> section are <tt>RESET</tt>, <tt>DESIGNABLE</tt>, <tt>SCRIPTABLE</tt> and <tt>STORED</tt>. <p> <tt>RESET</tt> names a function that will set the property to its default state (which may have changed since initialization). The function must return void and take no arguments. @@ -165,24 +165,24 @@ when storing an object's state. Stored makes only sense for writable properties. The default value is <tt>TRUE</tt>. Technically superfluous properties (like <a href="ntqpoint.html">TQPoint</a> pos if <a href="ntqrect.html">TQRect</a> geometry is already a property) define this to be <tt>FALSE</tt>. -<p> Connected to the property system is an additional macro, "Q_CLASSINFO", +<p> Connected to the property system is an additional macro, "TQ_CLASSINFO", that can be used to attach additional name/value-pairs to a class' meta object, for example: <p> <pre> - Q_CLASSINFO( "Version", "3.0.0" ) + TQ_CLASSINFO( "Version", "3.0.0" ) </pre> <p> Like other meta data, class information is accessible at runtime through the meta object, see <a href="ntqmetaobject.html#classInfo">TQMetaObject::classInfo</a>() for details. <p> <a name="override"></a> -<h2> Q_OVERRIDE +<h2> TQ_OVERRIDE </h2> <a name="1"></a><p> When you inherit a <a href="ntqobject.html">TQObject</a> subclass you may wish to override some aspects of some of the class's properties. <p> For example, in <a href="ntqwidget.html">TQWidget</a> we have the autoMask property defined like this: <pre> - Q_PROPERTY( bool autoMask READ autoMask WRITE setAutoMask DESIGNABLE false SCRIPTABLE false ) + TQ_PROPERTY( bool autoMask READ autoMask WRITE setAutoMask DESIGNABLE false SCRIPTABLE false ) </pre> <p> But we need to make the auto mask property designable in some TQWidget @@ -191,20 +191,20 @@ scriptable (e.g. for TQSA). This is achieved by overriding these features of the property in a subclass. In <a href="ntqcheckbox.html">TQCheckBox</a>, for example, we achieve this using the following code: <pre> - Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) + TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) </pre> <p> Another example is <a href="ntqtoolbutton.html">TQToolButton</a>. By default TQToolButton has a read-only "toggleButton" property, because that's what it inherits from TQButton: <pre> - Q_PROPERTY( bool toggleButton READ isToggleButton ) + TQ_PROPERTY( bool toggleButton READ isToggleButton ) </pre> <p> But we want to make our tool buttons able to be toggled, so we write a WRITE function in TQToolButton, and use the following property override to make it acessible: <pre> - Q_OVERRIDE( bool toggleButton WRITE setToggleButton ) + TQ_OVERRIDE( bool toggleButton WRITE setToggleButton ) </pre> The result is read-write (and scriptable and designable, since we now |