What is the best way of displaying a QML file with custom QT C++ code ? I tried creating a QWidget without a window border like
main.cpp
#include "stdafx.h"
#include "myqmlapp.h"
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyQMLApp w(NULL, Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
w.show();
return a.exec();
}
myqmlapp.cpp
MyQMLApp::MyQMLApp(QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags), qmlView(this)
{
QApplication::instance()->connect(qmlView.engine(), SIGNAL(quit()), SLOT(quit()));
qmlView.setSource(QUrl("qrc:test1.qml"));
qmlView.show();
ui.setupUi(this);
}
And my application window is this widget. So the only thing visible is the output of my QML file. But this has some problems. Since I don't have a window border I can't do resize/move.
How can I implement a window border with QML ?