Files
qt-creator/tests/manual/debugger/qquick2/main.cpp
Kai Koehne e8241adae3 Debugger: Add simple app to test mixed QML/CPP debugging (QQuick2)
Change-Id: Id744e3306da20bd7e2051ec4c45e3475084b64bc
Reviewed-by: hjk <qthjk@ovi.com>
2012-01-24 10:39:53 +01:00

42 lines
787 B
C++

#include <QGuiApplication>
#include <QQuickView>
#include <QDeclarativeContext>
#include <QDeclarativeEngine>
#include <QDebug>
class Backend : public QObject {
Q_OBJECT
public:
Q_INVOKABLE void greet(const QString &toWhom);
signals:
void greetBack(const QString &toWhom);
};
void Backend::greet(const QString &toWhom)
{
// bp here should be hit on startup
qDebug() << "hello" << toWhom;
// let's call back through signal ...
emit greetBack("QML");
}
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QQuickView view;
Backend backend;
view.rootContext()->setContextProperty("backend", &backend);
view.setSource(QUrl::fromLocalFile(SRCDIR"/qml/main.qml"));
view.show();
app.exec();
}
#include "main.moc"