C++ GUI Programming with Qt 4 (2nd Edition) (Prentice Hall Open Source Software Development Series)
All
Stack Overflow 26
This Year
Stack Overflow 3
This Month
Stack Overflow 4
You are able to use any C++ code you would like. I have have actually had questions with the same thought process in my day to day work. First you need to grok the idea that Qt uses normal C++ and special tools to create a robust set of libraries.
Later on come back and you will want to learn more about the items below:
There are other things too, but knowledge in these areas will let you make some decent desktop applications. My favorite reference is older, but still a goodie: "C++ GUI Programming with Qt4" http://www.amazon.com/Programming-Edition-Prentice-Software-Development/dp/0132354160
Yes QT4 is "old" and QT5 has been out for some time... but the book provides a solid foundation that you will be able to add information to.
Here's what I do:
Generate the code from Qt Creator. This gives you a class with some name like Ui::MyDialog. Then, create a class that derives from Ui::MyDialog. Create the slots you need for the dialog in the derived class.
In the constructor, call the setupUi() method, and then connect the slots to the signals in the dialog's widgets. Elsewhere in your program (in the main() function, maybe) construct the derived class and then call its show() method.
I notice that Qt Creator doesn't show you the code it generates from your dialog's UI file. It might be instructive to use Qt Designer to see the C++ code it produces. This might give you a better idea of what to do with Creator.
A good book for learning Qt is C++ GUI Programming with Qt 4 by Blanchette and Summerfield: http://www.amazon.com/gp/product/0132354160/ref=ase_trolltech/. If you're interested in Qt, I highly recommend this.
You definitely need to read a Qt tutorial (and maybe a C++ tutorial depending on your knowledge of C++).
Have a look at this SO question : https://stackoverflow.com/questions/475345/
Doing the tutorial, you'll learn how to add buttons to a form and how a function will be triggered when a button is clicked.
I also recommend reading C++ GUI Programming with Qt 4.
Your problem is very simple.
Create console application in QtCreator, and edit your
main.cpp
this way:And you'll got output like:
P.S. But my advice to you is learn C++ (add to your favorite this topic -- The Definitive C++ Book Guide and List), and then learn Qt (I recommend C++ GUI Programming with Qt 4 by Jasmin Blanchette & Mark Summerfield and Summerfields other books). Good luck!
Linux is the most accessible and has the most mature desktop functionality. BSD (in its various flavours) has less userspace baggage and would be easier to understand at a fundamental level. In this regard it is more like a traditional Unix than a modern Linux distribution. Some might view this as a good thing (and from certain perspectives it is) but will be more alien to someone familiar with Windows.
The main desktop distributions are Ubuntu and Fedora. These are both capable systems but differ somewhat in their userspace architecture The tooling for the desktop environment and default configuration for system security works a bit differently on Ubuntu than it does on most other Linux or Unix flavours but this is of little relevance to development. From a user perspective either of these would be a good start.
From a the perspective of a developer, all modern flavours of Unix and Linux are very similar and share essentially the same developer tool chain. If you want to learn about the system from a programmer's perspective there is relatively little to choose.
Most unix programming can be accomplished quite effectively with a programmer's editor such as vim or emacs, both of which come in text mode and windowing flavours. These editors are very powerful and have rather quirky user interfaces - the user interfaces are ususual but contribute significantly to the power of the tools. If you are not comfortable with these tools, this posting discusses several other editors that offer a user experience closer to common Windows tooling.
There are several IDEs such as Eclipse that might be of more interest to someone coming off Windows/Visual Studio.
Some postings on Stackoverflow that discuss linux/unix resources are:
What are good linux-unix books for an advancing user
What are some good resources for learning C beyond K&R
Resources for learning C program design
If you have the time and want to do a real tour of the nuts and bolts Linux From Scratch is a tutorial that goes through building a linux installation by hand. This is quite a good way to learn in depth.
For programming, get a feel for C/unix from K&R and some of the resources mentioned in the questions linked above. The equivalent of Petzold, Prosise and Richter in the Unix world are W Richard Stevens' Advanced Programming in the Unix Environment and Unix Network Programming vol. 1 and 2.
Learning one of the dynamic languages such as Perl or Python if you are not already familiar with these is also a useful thing to do. As a bonus you can get good Windows ports of both the above from Activestate which means that these skills are useful on both platforms.
If you're into C++ take a look at QT. This is arguably the best cross-platform GUI toolkit on the market and (again) has the benefit of a skill set and tool chain that is transferrable back into Windows. There are also several good books on the subject and (as a bonus) it also works well with Python.
Finally, Cygwin is a unix emulation layer that runs on Windows and gives substantially unix-like environment. Architecturally, Cygwin is a port of glibc and the crt (the GNU tool chain's base libraries) as an adaptor on top of Win32. This emulation layer makes it easy to port unix/linux apps onto Cygwin. The platform comes with a pretty complete set of software - essentially a full linux distribution hosted on a Windows kernel. It allows you to work in a unix-like way on Windows without having to maintain a separate operating system installations. If you don't want to run VMs, multiple boots or multiple PCs it may be a way of easing into unix.
C++ GUI Programming with Qt4
I also would like to recommend this book: C++ GUI Programming with Qt 4.
It is my favorite !
I would suggest reading the book C++ GUI Programming with Qt4.
It covers almost all features of Qt, is easy to read for a beginner, and also includes an introduction to C++ and Java, explaining the basic concepts required for developing with Qt.
I really enjoyed this book.