diff --git a/Nim/NimQml/NimQmlMacros.nim b/Nim/NimQml/NimQmlMacros.nim new file mode 100644 index 0000000..8babe18 --- /dev/null +++ b/Nim/NimQml/NimQmlMacros.nim @@ -0,0 +1,360 @@ +## Contains helper macros for NimQml + +import macros +import strutils +import typetraits +import tables + +static: + let nimFromQtVariant = { + "int" : "intVal", + "string" : "stringVal", + "bool" : "boolVal" , + }.toTable + + let nim2QtMeta = { + "bool": "Bool", + "int " : "Int", + "string" : "QString", + "pointer" : "VoidStar", + "QVariant": "QVariant", + "" : "Void", # no return, which is represented by an nnkEmpty node + }.toTable + +proc getNodeOf*(tree: PNimrodNode, kind: TNimrodNodeKind): PNimrodNode {.compileTime.} = + ## recursively looks for a node of kind, ``kind``, in the tree provided as ``tree`` + ## Returnsthe first node that satisfies this condition + for i in 0.. 2: # more args than just type + for i in 2..