BlackBerry 10 Running pure qt QML Program

Source: Internet
Author: User

Program directory Structure



Main.cpp Code

Note the path to the Qml file, and compare the file and directory structure in the following post-packaged bar file (figure)

App/native/assets/myqml.qml

#include <QApplication>
#include <QDeclarativeView>
#include <QObject>

int main (int ARGC, Char *argv[])
{
	qapplication app (argc, argv);

    Qdeclarativeview view;
    View.setsource (Qurl ("app/native/assets/myqml.qml"));

    View.setattribute (Qt::wa_autoorientation, true);
    View.setresizemode (Qdeclarativeview::sizerootobjecttoview);
    View.showmaximized ();

    return app.exec ();
}


File and directory structure in the packaged bar file (figure)



MYQML.QML Code:

Import QtQuick 1.1

Rectangle {
    width:360
    height:360
    Text {
        text:qstr ("Hello World QML")
        Anchors.centerIn:parent
    }
    mousearea {
        anchors.fill:parent
        onclicked: {
            qt.quit ();
        }
    }
}


Operation effect as shown in figure



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.