Hey guys I am really new to the C++ programing I have a little knowledge in C and a bit more in C++, but I do not know them enough to call myself a programmer. I am working as a PHP Web Developer I like being a crafts man and creating things so that is the reason to combine the programming with web development. I think that I could really benefit from both of them and so... My question is:

  • Is it a good Idea to learn C++ with Qt or not?
  • Can you give me pros and cons of both?

Note: I do not want to become a programmer and give up the web development I want to combine them both.

3 Answers 3


For learning C++, Qt has some good things and some bad things.

The good:

  • It provides the building blocks for everything you might want to do with C++, from network programming and threads to OpenGL and displaying web content.
  • It has a few tricks up it sleeves to make things a little easier. For example, it uses the parent hierarchy to handle object deletion makes memory leaks much less common. It also uses signals and slots to provide a somewhat sensible way to write event-driven programs.

The bad things are mostly corollaries of the good things:

  • Because it has everything wrapped up into a nice, cohesive whole, you are de facto encouraged to only use its things. For instance, you'll be using QString and QList instead of std::string and std::list, because that's what you'll get from Qt classes and that's what Qt classes expect you to provide.
  • When you eventually write non-Qt code with C++, you'll be missing some of the safety nets. You will really have to be responsible with your memory deallocation, and you'll have to learn the other patterns for doing event-driven code in C++.

Without Qt, you'll have to find some external or system library (e.g., outside the C++ standard) for: threads, network programming, GUI programming, graphics rendering (to the screen or to image files), XML parsing, rendering web content, etc. Qt includes classes for all of those things. But if you want to eventually become a generic C++ programmer, you'll need to learn how to program without it.


Make sure that you know the concepts of object oriented programming, and the specific way in which C++ implements it. Some examples could be operator overloading and multiple inheritance.

I would start by building simple console applications, because they are an easy way to have quick feedback about what you are doing.

When you will have already some knowledge of C++ programming, using any Qt will be fun, because you will be able to draw windows and UI controls etc.

Looking at a library is good because it gives you a good example about how you can structure your code.


If you want to combine them both, then forget Qt, instead look to simple add-on extensions to PHP either via the command line (called using an system exec call), as a soap server (try gsoap) or as full PHP extensions. then you'll see how you can call and work with a C++ program from your web code which should keep part of the familiarity of coding you already have.

So: start with simple console applications that take input and return output on the command line (ie stdout). Then migrate to a soap server and keep most of your existing code, but restructure it to live in a class with lots of methods that you can call, input and output will be via the soap actions. Then (if necessary) further modify the code to act as a PHP extension.

Once you've progressed through those 3 steps of increasing complexity, you should have enough knowledge to fill out better ways of performing the same tasks.

Not the answer you're looking for? Browse other questions tagged or ask your own question.