From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/properties.html | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'doc/html/properties.html') diff --git a/doc/html/properties.html b/doc/html/properties.html index 45a972779..bba5d99ca 100644 --- a/doc/html/properties.html +++ b/doc/html/properties.html @@ -41,31 +41,31 @@ features like __property or [property]. Our solution works wit on the meta-object system that also provides object communication through signals and slots.

The Q_PROPERTY macro in a class declaration declares a -property. Properties can only be declared in classes that inherit TQObject. A second macro, Q_OVERRIDE, can be used to override some +property. Properties can only be declared in classes that inherit TQObject. A second macro, Q_OVERRIDE, can be used to override some aspects of an inherited property in a subclass. (See Q_OVERRIDE.)

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:

The read, write, and reset functions must be public member functions from the class in which the property is defined.

Properties can be read and written through generic functions in -TQObject without knowing anything about the class in use. These two +TQObject without knowing anything about the class in use. These two function calls are equivalent:

     // TQButton *b and TQObject *o point to the same button
@@ -76,21 +76,21 @@ function calls are equivalent:
 

Equivalent, that is, except that the first is faster, and provides much better diagnostics at compile time. When practical, the first is better. However, since you can get a list of all available properties -for any TQObject through its TQMetaObject, TQObject::setProperty() +for any TQObject through its TQMetaObject, TQObject::setProperty() can give you control over classes that weren't available at compile time. -

As well as TQObject::setProperty(), there is a corresponding TQObject::property() function. TQMetaObject::propertyNames() returns -the names of all available properties. TQMetaObject::property() +

As well as TQObject::setProperty(), there is a corresponding TQObject::property() function. TQMetaObject::propertyNames() returns +the names of all available properties. TQMetaObject::property() returns the property data for a named property: a TQMetaProperty object.

Here's a simple example that shows the most important property functions in use:

-    class MyClass : public TQObject
+    class MyClass : public TQObject
     {
         Q_OBJECT
     public:
-        MyClass( TQObject * parent=0, const char * name=0 );
+        MyClass( TQObject * parent=0, const char * name=0 );
         ~MyClass();
 
         enum Priority { High, Low, VeryHigh, VeryLow };
@@ -112,31 +112,31 @@ to return either the type itself, a pointer to it, or a reference to
 it. The optional write function must return void and must take exactly
 one argument, either the type itself, a pointer or a const reference
 to it. The meta object compiler enforces this.
-

The type of a property can be any TQVariant supported type or an +

The type of a property can be any TQVariant supported type or an enumeration type declared in the class itself. Since MyClass uses the enumeration type Priority for the property, this type must be registered with the property system as well.

There are two exceptions to the above: The type of a property can also -be either TQValueList<TQVariant> or TQMap<TQString,TQVariant>. In -these cases the type must be specified as TQValueList or as TQMap +be either TQValueList<TQVariant> or TQMap<TQString,TQVariant>. In +these cases the type must be specified as TQValueList or as TQMap (i.e. without their template parameters).

It is possible to set a value by name, like this:

     obj->setProperty( "priority", "VeryHigh" );
 
-In the case of TQValueList and TQMap properties the value passes -is a TQVariant whose value is the entire list or map. +In the case of TQValueList and TQMap properties the value passes +is a TQVariant whose value is the entire list or map.

Enumeration types are registered with the Q_ENUMS macro. Here's the final class declaration including the property related declarations:

-    class MyClass : public TQObject
+    class MyClass : public TQObject
     {
         Q_OBJECT
         Q_PROPERTY( Priority priority READ priority WRITE setPriority )
         Q_ENUMS( Priority )
     public:
-        MyClass( TQObject * parent=0, const char * name=0 );
+        MyClass( TQObject * parent=0, const char * name=0 );
         ~MyClass();
 
         enum Priority { High, Low, VeryHigh, VeryLow };
@@ -163,7 +163,7 @@ you can specify a boolean member function.
 

STORED declares whether the property's value must be remembered when storing an object's state. Stored makes only sense for writable properties. The default value is TRUE. Technically superfluous -properties (like TQPoint pos if TQRect geometry is already a property) +properties (like TQPoint pos if TQRect geometry is already a property) define this to be FALSE.

Connected to the property system is an additional macro, "Q_CLASSINFO", that can be used to attach additional name/value-pairs to a class' @@ -173,13 +173,13 @@ meta object, for example:

Like other meta data, class information is accessible at runtime -through the meta object, see TQMetaObject::classInfo() for details. +through the meta object, see TQMetaObject::classInfo() for details.

Q_OVERRIDE

-

When you inherit a TQObject subclass you may wish to override some +

When you inherit a TQObject subclass you may wish to override some aspects of some of the class's properties. -

For example, in TQWidget we have the autoMask property defined like +

For example, in TQWidget we have the autoMask property defined like this:

     Q_PROPERTY( bool autoMask READ autoMask WRITE setAutoMask DESIGNABLE false SCRIPTABLE false )
@@ -188,13 +188,13 @@ this:
 

But we need to make the auto mask property designable in some TQWidget subclasses. Similarly some classes will need this property to be scriptable (e.g. for TQSA). This is achieved by overriding these -features of the property in a subclass. In TQCheckBox, for example, we +features of the property in a subclass. In TQCheckBox, for example, we achieve this using the following code:

     Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true )
 
-

Another example is TQToolButton. By default TQToolButton has a read-only +

Another example is TQToolButton. By default TQToolButton has a read-only "toggleButton" property, because that's what it inherits from TQButton:

     Q_PROPERTY( bool toggleButton READ isToggleButton )
-- 
cgit v1.2.1