Skip to content

Instantly share code, notes, and snippets.

@elpuri
Created December 26, 2010 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elpuri/755561 to your computer and use it in GitHub Desktop.
Save elpuri/755561 to your computer and use it in GitHub Desktop.
Minimal Qt app that runs a QML file
import Qt 4.7
Rectangle {
width: 360
height: 640
color: "#000000"
Rectangle {
height: 80
anchors.left: parent.left; anchors.right: parent.right
anchors.leftMargin: 30; anchors.rightMargin: 30
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
color: "#dd0000"
Text {
anchors.centerIn: parent
font.pixelSize: 30
text: "Quit"
color: "#e0e0e0"
}
MouseArea {
anchors.fill: parent
onClicked: Qt.quit();
}
}
}
QT += core gui declarative
TARGET = helloqml
TEMPLATE = app
SOURCES += main.cpp
symbian {
TARGET.UID3 = 0xe5519cad
TARGET.EPOCSTACKSIZE = 0x14000
TARGET.EPOCHEAPSIZE = 0x020000 0x2000000
}
#include <QtGui/QApplication>
#include <QDeclarativeView.h>
int main(int argc, char *argv[])
{
QApplication::setGraphicsSystem("openvg");
QApplication a(argc, argv);
QDeclarativeView w;
#ifdef Q_OS_SYMBIAN
w.setSource(QUrl::fromLocalFile("e:/qml/hello.qml"));
#else
w.setSource(QUrl::fromLocalFile("hello.qml"));
#endif
QDeclarativeEngine* engine = w.engine();
QObject::connect(engine, SIGNAL(quit()), &a, SLOT(quit()));
#if defined(Q_OS_SYMBIAN)
w.showFullScreen();
#else
w.show();
#endif
return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment