GammaRay API Documentation  3.2.0
Typedefs | Functions
GammaRay::VariantHandler Namespace Reference

Variant conversion functions, extendable by plugins. More...

Typedefs

typedef QString(* GenericStringConverter) (const QVariant &value, bool *ok)
 Callback type for generic string converters.
 

Functions

QVariant decoration (const QVariant &value)
 Returns a value representing value in a itemview decoration role. More...
 
QString displayString (const QVariant &value)
 Returns a human readable string version of the QVariant value. More...
 
template<typename T >
QString displayString (T value)
 Returns a human readable string version of the given value. More...
 
void registerGenericStringConverter (GenericStringConverter converter)
 Register a generic string conversion function for various variant types. More...
 
template<typename T , typename FuncT >
void registerStringConverter (FuncT f)
 Register a string conversion function for a variant type. More...
 
void registerStringConverter (int type, Converter< QString > *converter)
 Register a string conversion functions for a variant type. More...
 
QVariant serializableVariant (const QVariant &value)
 Converts the given variant into an variant of a different type that can be transferred to another process. More...
 

Detailed Description

Variant conversion functions, extendable by plugins.

Function Documentation

◆ decoration()

QVariant GammaRay::VariantHandler::decoration ( const QVariant &  value)

Returns a value representing value in a itemview decoration role.

Parameters
valueis a QVariant.
Returns
a QVariant itemview decoration role.

◆ displayString() [1/2]

QString GammaRay::VariantHandler::displayString ( 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.

◆ displayString() [2/2]

template<typename T >
QString GammaRay::VariantHandler::displayString ( value)
inline

Returns a human readable string version of the given value.

Thihs is a convenience overload of the QVariant-based version above.

Returns
a QString containing the human readable string.

◆ registerGenericStringConverter()

void GammaRay::VariantHandler::registerGenericStringConverter ( GenericStringConverter  converter)

Register a generic string conversion function for various variant types.

This can be used when you have a converter that can dynamically check if it can handle a given variant, and the types it can handle aren't known at compile time (example: QQmlListProperty).

Parameters
converterThe converter function. It's second parameter is used to indicate if the value could be handled.

◆ registerStringConverter() [1/2]

template<typename T , typename FuncT >
void GammaRay::VariantHandler::registerStringConverter ( FuncT  f)
inline

Register a string conversion function for a variant type.

Template Parameters
TThe type for which to use this converter function.

◆ registerStringConverter() [2/2]

void GammaRay::VariantHandler::registerStringConverter ( int  type,
Converter< QString > *  converter 
)

Register a string conversion functions for a variant type.

◆ serializableVariant()

QVariant GammaRay::VariantHandler::serializableVariant ( const QVariant &  value)

Converts the given variant into an variant of a different type that can be transferred to another process.

This is most prominently needed for pointer types, e.g. const QMatrix4x4* -> QMatrix4x4, primarily for the fancy display delegate on the client side.


© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
GammaRay Qt-application inspection and manipulation tool
https://www.kdab.com/development-resources/qt-tools/gammaray/
Generated by doxygen 1.9.1