GammaRay utilities.
More...
|
QString | addressToString (const void *p) |
|
bool | descendantOf (const QObject *ascendant, const QObject *object) |
|
QString | displayString (const QObject *object) |
|
void | drawTransparencyPattern (QPainter *painter, const QRect &rect, int squareSize=8) |
|
QString | enumToString (const QVariant &value, const char *typeName=Q_NULLPTR, const QMetaObject *metaObject=Q_NULLPTR) |
|
GAMMARAY_CORE_DEPRECATED_EXPORT QString | enumToString (const QVariant &value, const char *typeName, const QObject *object) |
|
template<typename T > |
QString | enumToString (T value, const char *typeName=0, const QObject *object=0) |
|
template<typename T > |
T * | findParentOfType (QObject *object) |
|
QVariant | iconForObject (const QObject *object) |
|
QString | prettyMethodSignature (const QMetaMethod &method) |
|
QString | shortDisplayString (const QObject *object) |
|
int | signalIndexToMethodIndex (const QMetaObject *metaObject, int signalIndex) |
|
QString | tooltipForObject (const QObject *object) |
|
QString GammaRay::Util::addressToString |
( |
const void * |
p | ) |
|
Returns a string version (as a hex number starting with "0x") of the memory address p
.
- Parameters
-
p | is a pointer to an address in memory. |
- Returns
- a QString containing the human readable address string.
bool GammaRay::Util::descendantOf |
( |
const QObject * |
ascendant, |
|
|
const QObject * |
object |
|
) |
| |
Determines if the QObject obj
is a descendant of the QObject ascendant
.
- Parameters
-
- Returns
- true if
obj
is a descendant of ascendant
; false otherwise.
Returns a human readable string name of the specified QObject. This does include the type name.
- Parameters
-
object | is a pointer to a valid or null QObject. |
- Returns
- a QString containing the human readable display string.
void GammaRay::Util::drawTransparencyPattern |
( |
QPainter * |
painter, |
|
|
const QRect & |
rect, |
|
|
int |
squareSize = 8 |
|
) |
| |
Draws a transparency pattern, i.e. the common checkerboard pattern into rect
.
size
The size of the individual checkerboard squares.
QString GammaRay::Util::enumToString |
( |
const QVariant & |
value, |
|
|
const char * |
typeName = Q_NULLPTR , |
|
|
const QMetaObject * |
metaObject = Q_NULLPTR |
|
) |
| |
! Translates an enum or flag value into a human readable text.
- Parameters
-
value | The numerical value. Type information from the QVariant are used to find the corresponding QMetaEnum. |
typeName | Use this if the value has type int (e.g. the case for QMetaProperty::read). |
mo | QMetaObject possibly containing the definition of the enum. |
- Returns
- a QString containing the string version of the specified
value
.
GAMMARAY_CORE_DEPRECATED_EXPORT QString GammaRay::Util::enumToString |
( |
const QVariant & |
value, |
|
|
const char * |
typeName, |
|
|
const QObject * |
object |
|
) |
| |
Translates an enum or flag value into a human readable text.
- Parameters
-
value | The numerical value. Type information from the QVariant are used to find the corresponding QMetaEnum. |
typeName | Use this if the value has type int (e.g. the case for QMetaProperty::read). |
object | Additional QObject to search for QMetaEnums. |
- Returns
- a QString containing the string version of the specified
value
.
- Deprecated:
- Use the above enumToString overload.
template<typename T >
QString GammaRay::Util::enumToString |
( |
T |
value, |
|
|
const char * |
typeName = 0 , |
|
|
const QObject * |
object = 0 |
|
) |
| |
|
inline |
Convenience wrapper for the above, in case the enum value is not available in a QVariant already.
template<typename T >
T* GammaRay::Util::findParentOfType |
( |
QObject * |
object | ) |
|
Finds the parent QObject of the specified type T, if such exists.
- Parameters
-
- Returns
- zero on failure; else a pointer to a data type T.
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
-
- Returns
- on failure QVariant() is returned; else a QIcon
Returns a display string for method
. This includes return types and argument names, if available.
Short display string for a QObject, either the object name or the address. This does not include the type name.
- Parameters
-
int GammaRay::Util::signalIndexToMethodIndex |
( |
const QMetaObject * |
metaObject, |
|
|
int |
signalIndex |
|
) |
| |
Turns a signal index into a method index. Signals indexes are used internally by QObject as an optimization and are usually not exposed in public API. If you get them nevertheless, by using internals of QObject this method turns them into method indexes that work with public QMetaObject API.
- Parameters
-
metaObject | The meta object the signal belongs so |
- Since
- 2.2
Returns a suitable rich text tooltip string for object
.
- Parameters
-
object | a pointer to a valid or null QObject. |