Quantcast
Viewing all articles
Browse latest Browse all 4972

Throwing QML exception from C++ in QtQuick 2 application

What I do is to emit a signal when an error occurs. The net effect is essentially the same as throwing and catching an exception. In QML I do things like: Connections {     target: myCppObject     onFileNotFoundError: messageBox.show("Could not find file") } messageBox is a QtQuick item that can be made visible through a show() method. It may be just a Rectangle with a Text and an OK button for example. I’m not aware of any way to throw an exception in C++ and have this somehow converted to a javascript exception in QML.

Viewing all articles
Browse latest Browse all 4972

Trending Articles