Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learning Qt4
#1
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)
{

}
#2
I hate "Helloworld"s
[Image: bxj6gaq99c9hyvinfkvn.jpg]
[Image: w0l5y0.png]
#3
MindHACKer Wrote:I hate "Helloworld"s


thanks for that lovely contribution!
#4
Isn't this C language?
I need to get a life.
#5
my particular example is written in c++.


Qt does have c and c++ libraries though.
#6
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.
"Most people think time is like a river, that flows swift and sure in one direction. But I have seen the face of time, and I can tell you, they are wrong. Time is an ocean in a storm."
#7
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!
[Image: bxj6gaq99c9hyvinfkvn.jpg]
[Image: w0l5y0.png]
#8
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

Users browsing this thread: 1 Guest(s)