Tuesday, May 22, 2012

HTML To PDF

Hey all, just a quick post.

I found a .exe file that converts html to pdf. Kind of nifty. Now I need to try integrating this into a web app to see if I can churn PDFs on the fly.

If you are interested in it as well, here's the link:
http://code.google.com/p/wkhtmltopdf/

Wednesday, May 9, 2012

Dynamically creating QML objects via Javascript

Hey all, Now in the midst of work so this is going to be a quick post. I needed to create QML Objects on the fly and needed to do it via Javascript. So how do I do it? Here's the quick and dirty, read it yourself!

// Variables
ListModel {
    id: listModelData
}

function splitStringToArray(stringToSplit) {

    var stringArray = stringToSplit.split(';');

    console.log("Length: " + stringArray.length)

    for(var i = 0; i < stringArray.length; i++) {
        var splitStr = stringArray[i]
        var model = Qt.createQmlObject('import QtQuick 1.1; ListModel {}', parentQMLObject);
        model.append({"name":"test"});

        listModelData.append({"model":model})
        console.log("Test model: " + model.get(0).name)
        console.log("Test listModelData: " + listModelData.get(0).model.get(0).name)
    }
}
There!

Have fun!