Function qt_core::q_variant_from_value
source · pub unsafe fn q_variant_from_value(
t: impl CastInto<Ref<QVariant>>
) -> CppBox<QVariant>
Expand description
Returns a variant containing a copy of the given value with template type T
.
Calls C++ function: QVariant qVariantFromValue(const QVariant& t)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for QVariant qVariantFromValue(const T &value)
:
Returns a variant containing a copy of the given value with template type T
.
This function is equivalent to QVariant::fromValue(value).
Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.
For example, a QObject pointer can be stored in a variant with the following code:
QObject *object = getObjectFromSomewhere(); QVariant data = QVariant::fromValue(object);
See also QVariant::fromValue().