ページ

Friday, February 26, 2010

It's about time to get ready to learn Qt programming for embedded systems or something like MeeGo?

Intel and Nokia announced MeeGo, which is a combination of the Moblin and Maemo platforms.
As for developing the application, it seems Qt is ( a or the default ?) development framework for MeeGo.

So I tried using Qt Creator for Windows to investigate how difficult or easy to develop the software.


MeeGo
http://meego.com/

Qt Creator



As usual, I just created very very verrrry simple Qt GUI application.(it's nothing special.)






 I think this software development is not so hard unless I will try to create complex programs.
and I think Qt must be very useful for not only embedded software but also some applications on linux and MacOS as well.


main.cpp
#include "mainwindow.h"
#include "qlabel.h"
#include "qtextcodec.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());

MainWindow w;
w.setWindowTitle("Qt Application Demo");
w.setMaximumSize(400,260);
w.setMinimumSize(400,260);
w.resize(400,260);
QLabel *lbl = new QLabel(&w);
lbl->setFrameStyle(QFrame::Panel | QFrame::Sunken);
lbl->setText("<font color=red>Hello World!</font>");
QFont font("Verdana",32,12,false);
lbl->setFont(font);
lbl->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
lbl->setGeometry(30,40,340,180);
w.show();
return a.exec();
}


mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

QAction* exitAction = new QAction(tr("終了(&X)"),this);
exitAction->setStatusTip("アプリケーションを終了します。");
connect(exitAction,SIGNAL(triggered()),this,SLOT(close()));

QMenu* menu = this->menuBar()->addMenu(tr("メニュー(&M)"));
menu->addAction(exitAction);


}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}

No comments:

Post a Comment