GammaRay API Documentation
3.2.0
|
GammaRay probe utilities. More...
Functions | |
QString | addressToString (const void *p) |
Returns a string version (as a hex number starting with "0x") of the memory address p . More... | |
bool | descendantOf (const QObject *ascendant, const QObject *object) |
Determines if the QObject obj is a descendant of the QObject ascendant . More... | |
QString | displayString (const QObject *object) |
Returns a human readable string name of the specified QObject. More... | |
void | drawTransparencyPattern (QPainter *painter, const QRect &rect, int squareSize=8) |
Draws a transparency pattern, i.e. More... | |
GAMMARAY_CORE_DEPRECATED_EXPORT QString | enumToString (const QVariant &value, const char *typeName, const QObject *object) |
Translates an enum or flag value into a human readable text. More... | |
template<typename T > | |
T * | findParentOfType (QObject *object) |
Finds the parent QObject of the specified type T, if such exists. More... | |
int | iconIdForObject (const QObject *object) |
Returns a class icon id for the given object. More... | |
bool | isNullish (void *ptr) |
Checks if the given pointer should be considered a nullptr. More... | |
QString | prettyMethodSignature (const QMetaMethod &method) |
Returns a display string for method . More... | |
QString | shortDisplayString (const QObject *object) |
Short display string for a QObject, either the object name or the address. More... | |
int | signalIndexToMethodIndex (const QMetaObject *metaObject, int signalIndex) |
Turns a signal index into a method index. More... | |
QString | tooltipForObject (const QObject *object) |
Returns a suitable rich text tooltip string for object . More... | |
const QObject * | uncheckedQObjectCast (const QVariant &v) |
QVariant::value<QObject *>() dereferences the object internally, this method converts it to a QObject without dereferencing (e.g. More... | |
GammaRay probe utilities.
|
inline |
Returns a string version (as a hex number starting with "0x") of the memory address p
.
p | is a pointer to an address in memory. |
bool GammaRay::Util::descendantOf | ( | const QObject * | ascendant, |
const QObject * | object | ||
) |
Determines if the QObject obj
is a descendant of the QObject ascendant
.
ascendant | is a pointer to a QObject. |
object | is a pointer to a QObject. |
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.
This does include the type name.
object | is a pointer to a valid or null QObject. |
void GammaRay::Util::drawTransparencyPattern | ( | QPainter * | painter, |
const QRect & | rect, | ||
int | squareSize = 8 |
||
) |
Draws a transparency pattern, i.e.
the common checkerboard pattern into rect
.
painter | The QPainter to draw with. |
rect | The area to draw into. |
squareSize | The size of the individual checkerboard squares. |
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.
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. |
value
. T* GammaRay::Util::findParentOfType | ( | QObject * | object | ) |
Finds the parent QObject of the specified type T, if such exists.
object | is a pointer to a QObject. |
int GammaRay::Util::iconIdForObject | ( | const QObject * | object | ) |
Returns a class icon id for the given object.
In normal operation a positive integer is returned containing the icon most closely associated with the data type pointed to by object
object | is a pointer to a QObject. |
|
inline |
Checks if the given pointer should be considered a nullptr.
One would assume this to be trivial, but there are some interesting hacks in for example the QSG software renderer that use near-null values to not trigger normal nullptr checks but are still effectively null as far as we are concerned (as in: we will crash for sure when dereferencing them).
QString GammaRay::Util::prettyMethodSignature | ( | const QMetaMethod & | method | ) |
Returns a display string for method
.
This includes return types and argument names, if available.
QString GammaRay::Util::shortDisplayString | ( | const QObject * | object | ) |
Short display string for a QObject, either the object name or the address.
This does not include the type name.
object | valid or 0 QObject |
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.
metaObject | The meta object the signal belongs so |
signalIndex | The signal index to convert. |
QString GammaRay::Util::tooltipForObject | ( | const QObject * | object | ) |
Returns a suitable rich text tooltip string for object
.
object | a pointer to a valid or null QObject. |
|
inline |
QVariant::value<QObject *>() dereferences the object internally, this method converts it to a QObject without dereferencing (e.g.
to check then if it still exists).