diff options
Diffstat (limited to 'ui/qt/utils/variant_pointer.h')
-rw-r--r-- | ui/qt/utils/variant_pointer.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ui/qt/utils/variant_pointer.h b/ui/qt/utils/variant_pointer.h new file mode 100644 index 0000000..7a95a94 --- /dev/null +++ b/ui/qt/utils/variant_pointer.h @@ -0,0 +1,34 @@ +/** @file + * + * Range routines + * + * Roland Knall <rknall@gmail.com> + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef UI_QT_VARIANT_POINTER_H_ +#define UI_QT_VARIANT_POINTER_H_ + +#include <QVariant> + +template <typename T> class VariantPointer +{ + +public: + static T* asPtr(QVariant v) + { + return (T *) v.value<void *>(); + } + + static QVariant asQVariant(T* ptr) + { + return QVariant::fromValue((void *) ptr); + } +}; + +#endif /* UI_QT_VARIANT_POINTER_H_ */ |