(wL) Forums
Learning Qt4 - Printable Version

+- (wL) Forums (https://war-lords.net/forum)
+-- Forum: Resources (https://war-lords.net/forum/forum-31.html)
+--- Forum: Programming (https://war-lords.net/forum/forum-33.html)
+--- Thread: Learning Qt4 (/thread-2131.html)



Learning Qt4 - Leaky - Jun 22 2011

Is anyone interested in me doing a serious tutorial on how to create a functional application in Qt4 from the ground up? Vote on the poll, if there's enough interest then I'll document my current project as I work on it. Current project that I'm working on is a fairly simple Omegle (omegle.com) chat client. The tutorial would obviously demonstrate UI development, signals, slots, and networking using Qt, code in c++.


---

Qt4 is a widget based framework from nokia, mostly to do with GUI's but they have other APIs too for networking and stuff like that.

Here's a simple Hello World app:

main.cpp
Code:
#include <QApplication>
#include "include/MainWindow.h"

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    MainWindow mainWin;
    mainWin.show();

    return app.exec();
}
include/MainWindow.h:
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLabel>


class MainWindow : public QMainWindow
{
    public:
        MainWindow();
    protected:
        void closeEvent(QCloseEvent *event);
    private slots:
    private:
        QLabel *container;
};

#endif // MAINWINDOW_H
src/MainWindow.cpp:
Code:
#include "../include/MainWindow.h"

MainWindow::MainWindow()
{
    container = new QLabel(this);
    container->setText("Hello World!");
    setCentralWidget(container);
}

void MainWindow::closeEvent(QCloseEvent *event)
{

}



RE: Learning Qt4 - MindHACKer - Oct 15 2011

I hate "Helloworld"s


RE: Learning Qt4 - Leaky - Oct 18 2011

MindHACKer Wrote:I hate "Helloworld"s


thanks for that lovely contribution!


RE: Learning Qt4 - rAnSaCk - Oct 18 2011

Isn't this C language?


RE: Learning Qt4 - Leaky - Oct 18 2011

my particular example is written in c++.


Qt does have c and c++ libraries though.


RE: Learning Qt4 - naive - Oct 18 2011

I almost started using Qt4 from ruby native c extension yesterday, but didn't feel like installing a sane build enviroment for windows where I was gonna use the code. I ended up just settling on java swing (jruby). I'm writing a little google voice desktop sms client.


RE: Learning Qt4 - MindHACKer - Oct 25 2011

Leaky Wrote:
MindHACKer Wrote:I hate "Helloworld"s


thanks for that lovely contribution!

;D
It's just that they all post "Hello Worlds", why not post more advanced samples!


RE: Learning Qt4 - Leaky - Oct 25 2011

MindHACKer Wrote:
Leaky Wrote:
MindHACKer Wrote:I hate "Helloworld"s


thanks for that lovely contribution!

;D
It's just that they all post "Hello Worlds", why not post more advanced samples!

it's an introduction to UI development with Qt, it doesn't just print hello world, it builds a Qt window