[Qt-qml] QML without GUI?
Alan Alpert
alan.alpert at nokia.com
Thu Dec 1 23:13:33 CET 2011
On Fri, 2 Dec 2011 08:04:12 you wrote:
> Thanks. I actually want to put out HTML an other structured formats
> instead. Any clue how I could evaluate the object tree and get output?
> Trivial Example:
> Table {
> Row {
> bgcolor: "lightgray"
>
> Cell { id:"c00"; text: "11" }
> Cell {id:"c01"; text: "12" }
> Cell { id:"c02"; text: "13" }
> }
>
> Row {
> bgcolor: "lightblue"
>
> Cell { id:"c10"; text: "21" }
> Cell { id:"c11"; text: "22" }
> Cell { id:"c12"; text: "23" }
> }
> }
> <TABLE><TR bgcolor="lightgray"><TD>11</TD>...</TR></TABLE>
>
> It looks rather silly, but only until you realize you have components, and
> can assemble your output with those.
What it sounds like is that you want to create your own import containing
these things, and then you just instantiate that. e.g.
import WebLike 1.0 as WL
WL.Body{
WL.Table{
WL.Row{
WL.Cell{ text: "Cellular" }
}
}
}
then use QDeclarativeComponent to instantiate it. You'll get a WL.Body root
item and all the instantiated subtree. Then your C++ program can traverse the
tree spitting out the appropriate HTML.
Or did you want more than just creating the objects with the properties and
bindings set up?
--
Alan Alpert
Senior Engineer
Nokia, Qt Development Frameworks
More information about the Qt-qml
mailing list