PDA

View Full Version : Learning C++ for Qt



dana
5th May 2010, 20:31
Hi,

I have some basic C++ knowledge but not enough to start working with Qt so I'm planning to learn C++.

In order to work on Qt, should I read everything about C++? I mean what parts in C++ is not important for Qt so I can skip it?

And what resources (Books or other means) are recommended?

regards,
Dana

Talei
5th May 2010, 20:54
You need to learn everything about C++.

Qt is a mere framework (written in C++), that means it's "bridge" between You and underlying operating system. In example, on Windows, to create simple GUI application You need to learn WinAPI, but on Linux Xlib. So assuming that you want to write a program that runs both on Windows and Linux You need to know 2API (WinAPI, Xlib (XCB)), but with Qt You need to learn only 1 "API" (Qt). So Qt takes care about everything for you. That said You can still use native API like WinAPI in your Windows program, but that way You can't port that program to Linux because simply Linux don't know what is i.e. GetWindowThreadProcessId(hwnd, &dwID) ; function. (although there may be some equivalent function in Linux, but that way you need to write something like ifdef Linux or something similar).

I would suggest reading this: http://www2.research.att.com/~bs/homepage.html, it's homepage of Bjarne Stroustrup (creator of C++), and Symfonia C++ TOM 1/2/3 Jerzy Grębosz (<- I don;t know if this position is available in other language the Polish)
And books like: Foundations of Qt Development, C++-GUI-Programming-with-Qt-4-1st-ed (if I remember correctly one of this books is available for free at qt official website)
Best luck

wysota
5th May 2010, 20:59
You need to know about:

C++ syntax, including functions, loops, pointers, references
classes and inheritance, constructors, destructors
public, protected, private access
virtual methods and reimplementing them
static methods
remaining paradigms of object oriented programming


I recommend Thinking in C++ and the Lippmann's book. You need a decent knowledge of C++ to understand what you are doing with Qt. I can't think of anything in C++ that you can omit. You can probably do without knowledge about templates, at least for some time. Multiple and virtual inheritance is probably not required, as well as overloading operators and detailed stuff like that.