diff --git a/src/nimqml/private/nimqmlmacros.nim b/src/nimqml/private/nimqmlmacros.nim index c6511c0..d5343e1 100644 --- a/src/nimqml/private/nimqmlmacros.nim +++ b/src/nimqml/private/nimqmlmacros.nim @@ -91,8 +91,8 @@ proc fromQVariantConversion(x: string): string {.compiletime.} = of "int": result = "intVal" of "string": result = "stringVal" of "bool": result = "boolVal" - of "float": result = "floatVal" - of "double": result = "doubleVal" + of "float32": result = "floatVal" + of "float": result = "doubleVal" of "QObject": result = "qobjectVal" of "QVariant": result = "" else: error("Unsupported conversion from QVariant to $1" % x) @@ -106,8 +106,8 @@ proc toMetaType(x: string): string {.compiletime.} = of "int": result = "Int" of "bool": result = "Bool" of "string": result = "QString" - of "double": result = "Double" - of "float": result = "Float" + of "float": result = "Double" + of "float32": result = "Float" of "pointer": result = "VoidStar" of "QVariant": result = "QVariant" of "QObject": result = "QObjectStar" diff --git a/src/nimqml/private/nimqmltypes.nim b/src/nimqml/private/nimqmltypes.nim index b2d7047..dddd111 100644 --- a/src/nimqml/private/nimqmltypes.nim +++ b/src/nimqml/private/nimqmltypes.nim @@ -75,6 +75,7 @@ type UnknownType = 0.cint, Bool = 1.cint, Int = 2.cint, + Double = 6.cint, QString = 10.cint, VoidStar = 31.cint, Float = 38.cint, diff --git a/src/nimqml/private/qvariant.nim b/src/nimqml/private/qvariant.nim index b5a796b..d98f87d 100644 --- a/src/nimqml/private/qvariant.nim +++ b/src/nimqml/private/qvariant.nim @@ -92,6 +92,11 @@ proc newQVariant*(value: QVariant): QVariant = result.setup(value) proc newQVariant*(value: float): QVariant = + ## Return a new QVariant given a float + new(result, delete) + result.setup(value.cdouble) + +proc newQVariant*(value: float32): QVariant = ## Return a new QVariant given a float new(result, delete) result.setup(value.cfloat)