KJSEmbed Types
Introduction
KJSEmbed adds a number of custom types to those defined by ECMA in
addition to the objects themselves. These types are used to pass
complex datatypes between scripts and the C++ code that is hosting the
script. This document describes the representations used to pass
information in each direction.
It should be noted that currently only a single representation is
available to scripts accessing native types. Scripts should not rely
on this behaviour as the restriction may be removed in a future
release of KJSEmbed so this, though the current script API will
continue to be supported.
Fundamental Types
Numbers
- int -> Number
- uint -> Number
- float -> Number
- double -> Number
- Number -> int
- Number -> uint
- Number -> float
- Number -> double
Strings
- QString -> String
- QCString -> String
- const char * -> String
- String -> QString
- String -> QCString
- String -> const char *
Qt Object Types
QColor
Represents a color, possibly including an alpha channel.
- QColor -> '#rrggbb'
- '#rrggbb' -> QColor
- '#rrggbbaa' -> QColor
QPoint
Represents a point.
- QPoint -> [x,y]
- [x,y] -> QPoint
- obj.x obj.y -> QPoint
QSize
Represents a size.
- QSize -> [w,h]
- [w,h] -> QSize
- obj.w obj.h -> QSize
QRect
Represents a rectangle.
- QRect -> [x,y,w,h]
- [x,y,w,h] -> QRect
- obj.x obj.y obj.w obj.h -> QRect
QDate
Represents a date.
QTime
Represents a time.
QDateTime
Represents a date/time pair.
QKeySequence
Represents a sequence of keys, eg. it is used for accelerators.
QFont
Represents a font.
KDE Object Types
KURL
Represents a URL.