From 0bc4f82ea7c3023f8ec08b9505beae4f135c9d15 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Sat, 6 Dec 2014 15:55:16 +0000 Subject: [PATCH] refs #247 Fine-tuned CVariant constructors. --- src/blackmisc/variant.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/blackmisc/variant.h b/src/blackmisc/variant.h index d8f43d051..8e6828c13 100644 --- a/src/blackmisc/variant.h +++ b/src/blackmisc/variant.h @@ -63,6 +63,15 @@ namespace BlackMisc //! Construct a null variant of the given type. CVariant(QVariant::Type type) : m_v(type) {} + //! Avoid unexpected implicit cast to QVariant::Type. (Use CVariant::from() instead.) + CVariant(int) = delete; + + //! Implicit conversion from QString. + CVariant(const QString &string) : m_v(string) {} + + //! Implicit conversion from C string. + CVariant(const char *string) : m_v(string) {} + //! Construct a variant from the given type and opaque pointer. CVariant(int typeId, const void *copy) : m_v(typeId, copy) {}