View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#22
Originally Posted by helex View Post
So the webremote you get if you enter the ip into your browser is also unable to send a correct keycode for the info button, too?
That's right. The web interface remote uses the same layout as yours.

Originally Posted by helex View Post
The second is a vague idea. It depends on the possibility to find a way to include a qml file into my ui in a crash protected way. At the moment the whole app crashes if there is a error in a included qml file. I would prefer a error message instead. But my inquiries about this topic were about 30 minutes... perhaps I will continue next month to search a solution.
Or have you already a good idea how to implement something like this?
I presume you are attempting to create the QML object statically? This will prevent the main.qml file from being loaded as the component that contains the error cannot be instantiated. If you create the QML object dynamically like this

Code:
function createObject(sourceFile, parentObject) {
    var component = Qt.createComponent(sourceFile);
    
    if (component.status == Component.Ready) {
        var guiObject = component.createObject(parentObject);
        
        if (guiObject == null) {
            console.log("Error creating object");
        }
        else {
            return guiObject
        }
    }
    else {
        console.log(component.errorString());
    }
}
then you can handle the error. In the above code, if the created component does not have status == Component.Ready, then the error is logged to the console. Otherwise, the created object is returned with parent as specified.

For more information, see

http://doc.qt.nokia.com/4.7-snapshot...nt-dynamically

and

http://doc.qt.nokia.com/4.7-snapshot/qml-component.html
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2012-02-28 at 20:35. Reason: typo in code
 

The Following User Says Thank You to marxian For This Useful Post: