Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
variant_pointer.h
Go to the documentation of this file.
1
14#ifndef UI_QT_VARIANT_POINTER_H_
15#define UI_QT_VARIANT_POINTER_H_
16
17#include <QVariant>
18
22template <typename T> class VariantPointer
23{
24
25public:
31 static T* asPtr(QVariant v)
32 {
33 return (T *) v.value<void *>();
34 }
35
41 static QVariant asQVariant(T* ptr)
42 {
43 return QVariant::fromValue((void *) ptr);
44 }
45};
46
47#endif /* UI_QT_VARIANT_POINTER_H_ */
A template utility class for converting between pointers and QVariant objects.
Definition variant_pointer.h:23
static QVariant asQVariant(T *ptr)
Converts a typed pointer into a QVariant.
Definition variant_pointer.h:41
static T * asPtr(QVariant v)
Converts a QVariant containing a void pointer back to a typed pointer.
Definition variant_pointer.h:31