[Development] QJSEngine debuging
Michal Dorner
dorner.michal at gmail.com
Tue Nov 20 12:29:35 CET 2012
2012/11/19 Koehne Kai <Kai.Koehne at digia.com>
>
> Hi,
>
> Even if you're not using QML, you might look into using it's debugging
> infrastructure. All you'll probably have to do is create a dummy QQmlEngine
> at the start of your app: Since breakpoints, stepping are global for v8,
> you should be able to debug any JS code run by your app from within Qt
> Creator. With a bit of work you could also implement an Eclipse backend:
> The debugging protocol of QML just wraps the V8 JSON one.
>
> Drop me a mail if you need further links.
>
> Regards
>
> Kai
>
2012/11/19 Kevin Krammer <kevin.krammer at kdab.com>
> On Monday, 2012-11-19, Koehne Kai wrote:
> Also, QML is not tied to UI at all.
>
> Cheers,
> Kevin
Hi,
thanks for all advices. I have looked better into qml and found it solves
all my problems (debuging, importing modules etc. ).
Before i misunderstood qml concept. I thought all qml is deeply connected
with QtQuick and gui.
Maybe some example describing this usecase will not be bad idea.
So, currently i have something like this (inspired by code from QQuickView):
......
qmlRegisterType<Test>("MyModule", 1, 0, "Test");
engine = new QQmlEngine();
component = new QQmlComponent(engine, QUrl::fromLocalFile("module.qml"));
if (!component->isLoading()) {
onComponentReady();
} else {
connect(component,
SIGNAL(statusChanged(QQmlComponent::Status)), this,
SLOT(onComponentReady()));
}
}
void QmlTest::onComponentReady()
{
disconnect(component,
SIGNAL(statusChanged(QQmlComponent::Status)), this,
SLOT(onComponentReady()));
if (component->isError()) {
QList<QQmlError> errorList = component->errors();
foreach (const QQmlError &error, errorList) {
QMessageLogger(error.url().toString().toLatin1().constData(),
error.line(), 0).warning()
<< error;
}
return;
}
Test *test = qobject_cast<Test *>( component->create() );
test->doSomeStuff();
Am i doing it right way?
Regards
Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121120/f8c0df63/attachment.html>
More information about the Development
mailing list