Hi!
I’m developing desktop app using Qt Quick 2.0 and I need to be able to access viewer class through QML in order to hide/minimise application ( I’m building app with custom window decorations ).
I fallowed this thread [Link] [qt-project.org] but no luck.
This is my main.cpp:
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
// viewer.rootContext()->setContextProperty("QmlApplicationViewer", (QObject *)&viewer);
viewer.setFlags(Qt::FramelessWindowHint);
viewer.setMainQmlFile(QStringLiteral("qml/ubusell/main.qml"));
viewer.showExpanded();
return app.exec();
}
After I add this line to default main.cpp file:
viewer.rootContext()->setContextProperty("QmlApplicationViewer", (QObject *)&viewer);
I get this error:
In function 'int main(int, char**)':
error: invalid use of incomplete type 'class QQmlContext'
error: forward declaration of 'class QQmlContext'
Any ideas ?
Thanks!
↧