Qt 4.8
Public Types | Public Functions | Public Variables | Related Functions | List of all members
QStyleHintReturn Class Reference

The QStyleHintReturn class provides style hints that return more than basic data types. More...

#include <qstyleoption.h>

Inheritance diagram for QStyleHintReturn:
QStyleHintReturnMask QStyleHintReturnVariant

Public Types

enum  HintReturnType { SH_Default =0xf000, SH_Mask, SH_Variant }
 
enum  StyleOptionType { Type = SH_Default }
 This enum is used to hold information about the type of the style option, and is defined for each QStyleHintReturn subclass. More...
 
enum  StyleOptionVersion { Version = 1 }
 This enum is used to hold information about the version of the style option, and is defined for each QStyleHintReturn subclass. More...
 

Public Functions

 QStyleHintReturn (int version=QStyleOption::Version, int type=SH_Default)
 Constructs a QStyleHintReturn with version version and type type. More...
 
 ~QStyleHintReturn ()
 

Public Variables

int type
 the type of the style hint container More...
 
int version
 the version of the style hint return container More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

The 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.

Warning
This function is not part of the public interface.

–Sam

Definition at line 907 of file qstyleoption.h.

Enumerations

◆ HintReturnType

◆ 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
Enumerator
Type 

Definition at line 913 of file qstyleoption.h.

◆ 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 do not need to check it.

See also
StyleOptionType
Enumerator
Version 

Definition at line 914 of file qstyleoption.h.

Constructors and Destructors

◆ QStyleHintReturn()

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

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 6227 of file qstyleoption.cpp.

6228  : version(version), type(type)
6229 {
6230 }
int type
the type of the style hint container
Definition: qstyleoption.h:920
int version
the version of the style hint return container
Definition: qstyleoption.h:919

◆ ~QStyleHintReturn()

QStyleHintReturn::~QStyleHintReturn ( )
Warning
This function is not part of the public interface.

Definition at line 6236 of file qstyleoption.cpp.

6237 {
6238 
6239 }

Friends and Related Functions

◆ qstyleoption_cast() [1/2]

T qstyleoption_cast< T > ( const QStyleHintReturn hint)
related

Returns a T or 0 depending on the type and 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 =
if (maskReturn) {
...
}
}
...
}
See also
QStyleHintReturn::type, QStyleHintReturn::version

Definition at line 944 of file qstyleoption.h.

945 {
946  if (hint && hint->version <= static_cast<T>(0)->Version &&
947  (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
948  return static_cast<T>(hint);
949  return 0;
950 }
int type
the type of the style hint container
Definition: qstyleoption.h:920
int version
the version of the style hint return container
Definition: qstyleoption.h:919

◆ qstyleoption_cast() [2/2]

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 953 of file qstyleoption.h.

954 {
955  if (hint && hint->version <= static_cast<T>(0)->Version &&
956  (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
957  return static_cast<T>(hint);
958  return 0;
959 }
int type
the type of the style hint container
Definition: qstyleoption.h:920
int version
the version of the style hint return container
Definition: qstyleoption.h:919

Properties

◆ type

QStyleHintReturn::type

the type of the style hint container

See also
HintReturnType

Definition at line 920 of file qstyleoption.h.

Referenced by qstyleoption_cast().

◆ version

QStyleHintReturn::version

the version of the style hint return container

This value can be used by subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast<T>(), you normally do not need to check it.

Definition at line 919 of file qstyleoption.h.

Referenced by qstyleoption_cast().


The documentation for this class was generated from the following files: