GammaRay  1.3.0
 All Classes Namespaces Files Functions Enumerations Enumerator Pages
Functions
GammaRay::Util Namespace Reference

GammaRay utilities. More...

Functions

QString addressToString (const void *p)
QString addressToUid (const void *p)
QVariant decorationForVariant (const QVariant &value)
bool descendantOf (const QObject *ascendant, const QObject *object)
QString displayString (const QObject *object)
QString enumToString (const QVariant &value, const char *typeName=0, QObject *object=0)
template<typename T >
T * findParentOfType (QObject *object)
QVariant iconForObject (QObject *object)
QString variantToString (const QVariant &value)

Detailed Description

GammaRay utilities.


Function Documentation

QString GammaRay::Util::addressToString ( const void *  p)

Returns a string version (as a hex number starting with "0x") of the memory address p.

Parameters:
pis a pointer to an address in memory.
Returns:
a QString containing the human readable address string.
QString GammaRay::Util::addressToUid ( const void *  p)

Returns a string version of the memory address p. The resulting string can be used as a unique identifier in GammaRay.

Parameters:
pis a pointer to an address in memory.
Returns:
a QString containing the Uid.
QVariant GammaRay::Util::decorationForVariant ( const QVariant &  value)

Returns a value representing value in a itemview decoration role.

Parameters:
valueis a QVariant.
Returns:
a QVariant itemview decoration role.
bool GammaRay::Util::descendantOf ( const QObject *  ascendant,
const QObject *  object 
)

Determines if the QObject obj is a descendant of the QObject ascendant.

Parameters:
ascendantis a pointer to a QObject.
objectis a pointer to a QObject.
Returns:
true if obj is a descendant of ascendant; false otherwise.
QString GammaRay::Util::displayString ( const QObject *  object)

Returns a human readable string name of the specified QObject.

Parameters:
objectis a pointer to a valid QObject.
Returns:
a QString containing the human readable display string.
QString GammaRay::Util::enumToString ( const QVariant &  value,
const char *  typeName = 0,
QObject *  object = 0 
)

Translates an enum or flag value into a human readable text.

Parameters:
valueThe numerical value. Type information from the QVariant are used to find the corresponding QMetaEnum.
typeNameUse this if the value has type int (e.g. the case for QMetaProperty::read).
objectAdditional QObject to search for QMetaEnums.
Returns:
a QString containing the string version of the specified value.
template<typename T >
T* GammaRay::Util::findParentOfType ( QObject *  object)

Finds the parent QObject of the specified type T, if such exists.

Parameters:
objectis a pointer to a QObject.
Returns:
zero on failure; else a pointer to a data type T.
QVariant GammaRay::Util::iconForObject ( QObject *  object)

Returns an icon for the given object. In normal operation a QIcon is returned containing the icon most closely associated with the data type pointed to by object

Parameters:
objectis a pointer to a QObject.
Returns:
on failure QVariant() is returned; else a QIcon
QString GammaRay::Util::variantToString ( const QVariant &  value)

Returns a human readable string version of the QVariant value. Converts to the variant type and prints the string value accordingly.

Parameters:
valueis a QVariant.
Returns:
a QString containing the human readable string.

Klarälvdalens Datakonsult AB (KDAB)
"The Cross-Platform Experts"
http://www.kdab.com/
GammaRay
Qt-application inspection and manipulation tool
http://www.kdab.com/kdab-products/gammaray/