QStyleHintReturn Class Reference

#include <qstyleoption.h>

Inheritance diagram for QStyleHintReturn:

Inheritance graph
[legend]
List of all members.

Detailed Description

the exposed rectangle, in item coordinatesthe complete transformation matrix for the itema simple metric for determining an item's level of detailThe QStyleHintReturn class provides style hints that return more than basic data types.

QStyleHintReturn and its subclasses are used to pass information from a style back to the querying widget. This is most useful when the return value from QStyle::styleHint() does not provide enough detail; for example, when a mask is to be returned.

### --Sam

Definition at line 728 of file qstyleoption.h.

Public Types

enum  HintReturnType
enum  StyleOptionType
enum  StyleOptionVersion

Public Member Functions

 QStyleHintReturn (int version=QStyleOption::Version, int type=SH_Default)
 ~QStyleHintReturn ()

Public Attributes

int version
int type

Related Functions

(Note that these are not member functions.)

qstyleoption_cast (const QStyleHintReturn *hint)
qstyleoption_cast (QStyleHintReturn *hint)


Member Enumeration Documentation

enum QStyleHintReturn::HintReturnType

SH_Default QStyleHintReturn SH_Mask QStyle::SH_RubberBand_Mask QStyle::SH_FocusFrame_Mask

Definition at line 730 of file qstyleoption.h.

00730                         {
00731         SH_Default=0xf000, SH_Mask
00732     };

enum QStyleHintReturn::StyleOptionType

This enum is used to hold information about the type of the style option, and is defined for each QStyleHintReturn subclass.

Type The type of style option provided ( SH_Default for this class).

The type is used internally by QStyleHintReturn, its subclasses, and qstyleoption_cast() to determine the type of style option. In general you do not need to worry about this unless you want to create your own QStyleHintReturn subclass and your own styles.

See also:
StyleOptionVersion

Definition at line 734 of file qstyleoption.h.

00734 { Type = SH_Default };

enum QStyleHintReturn::StyleOptionVersion

This enum is used to hold information about the version of the style option, and is defined for each QStyleHintReturn subclass.

Version 1

The version is used by QStyleHintReturn subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it.

See also:
StyleOptionType

Definition at line 735 of file qstyleoption.h.

00735 { Version = 1 };


Constructor & Destructor Documentation

QStyleHintReturn::QStyleHintReturn ( int  version = QStyleOption::Version,
int  type = SH_Default 
)

the type of the style hint containerthe version of the style hint return container

Constructs a QStyleHintReturn with version version and type type.

The version has no special meaning for QStyleHintReturn; it can be used by subclasses to distinguish between different version of the same hint type.

See also:
QStyleOption::version, QStyleOption::type

Definition at line 4325 of file qstyleoption.cpp.

04326     : version(version), type(type)
04327 {
04328 }

QStyleHintReturn::~QStyleHintReturn (  ) 

Definition at line 4334 of file qstyleoption.cpp.

04335 {
04336 
04337 }


Friends And Related Function Documentation

T qstyleoption_cast< T > ( const QStyleHintReturn hint  )  [related]

Returns a T or 0 depending on the {QStyleHintReturn::type}{type} and {QStyleHintReturn::version}{version} of hint.

Example:

        int MyStyle::styleHint(StyleHint stylehint, const QStyleOption *opt,
                               const QWidget *widget, QStyleHintReturn* returnData) const;
        {
            if (stylehint == SH_RubberBand_Mask) {
                const QStyleHintReturnMask *maskReturn =
                        qstyleoption_cast<const QStyleHintReturnMask *>(hint);
                if (maskReturn) {
                    ...
                }
            }
            ...
        }

See also:
QStyleHintReturn::type, QStyleHintReturn::version

Definition at line 755 of file qstyleoption.h.

00756 {
00757     if (hint && hint->version <= static_cast<T>(0)->Version &&
00758         (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
00759         return static_cast<T>(hint);
00760     return 0;
00761 }

T qstyleoption_cast< T > ( QStyleHintReturn hint  )  [related]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a T or 0 depending on the type of hint.

Definition at line 764 of file qstyleoption.h.

00765 {
00766     if (hint && hint->version <= static_cast<T>(0)->Version &&
00767         (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
00768         return static_cast<T>(hint);
00769     return 0;
00770 }


Member Data Documentation

int QStyleHintReturn::version

Definition at line 740 of file qstyleoption.h.

Referenced by qstyleoption_cast().

int QStyleHintReturn::type

Definition at line 741 of file qstyleoption.h.

Referenced by qstyleoption_cast().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 19:10:08 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1