Archive for February, 2011

>More QML learnings

Check original from blogger to see includes properly:
http://karoliinamaemoblog.blogspot.com/2011/02/more-qml-learnings.html

I was trying to figure out how to connect button click to C++. Here is very short how (sorry for bad formatting due to this html which does not like code):
main.cpp:

For this I had these includes:
#include
#include
#include
#include
#include
#include “qmlapplicationviewer.h”
#include

Then continued with my program specific includes

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
qmlRegisterType (“MetarClasses”,1,0,”Metar”);
viewer.setOrientation(QmlApplicationViewer::LockPortrait);
viewer.setMainQmlFile(QLatin1String(“qml/PilotHelper/main.qml”));
viewer.show();
Metar met;

return app.exec();
}

metar.h (from my unfinished application):

#include
#include

class Metar : public QObject {
Q_OBJECT
public:

explicit Metar(QObject *parent = 0);
~Metar();
QString readMetar(QString location);

public slots:

void replyFinishedSlot(QNetworkReply *reply);
void retrieveMetarClickedSlot();

private:
QNetworkAccessManager* nam;

};

metar.cpp:

implements clicked function

void Metar::retrieveMetarClickedSlot(){

qDebug () << "Click" << "\n";
QString myreply = readMetar(“EFHF”);
qDebug () << "METAR=" << myreply << "\n";

}

Then QML:

Imports:

import Qt 4.7
import QtQuick 1.0
import MetarClasses 1.0

Then button that sends click to the metar class:
Metar
{
id: met

}

Button
{
anchors.centerIn: parent
height: 50; width: 400
text: “Retrieve metar”
onClicked:(met.retrieveMetarClickedSlot())
}

(The button is custom button not defined in this snipplet, use your own button or button from meego (follow Kate Alhola’s Forum Nokia blog’s instructions how to do that).

>Powerful electric motors

>I found this one for example:

Turnigy CA120-70 Brushless Outrunner (100cc eq)

With two of these a small single seater would fly quite easily.