Downloads
Visual C
Visual C++ 6.0
Digital Visual Fortran 6.0
Visual Basic 6.0
Visual Fox Pro 6.0
BCB 5.0
Kylix 3
Qt 3.2 to 3.7 (Qt 4.1) free
KDevelop (KDE 3.1.0 to 3.5.7)
Documentation for the application "Display Box": A Simple Widget to Display
Either Text or a Picture or a Default; General Information
My audience is primarily intended to be hobbiest programmers, not profesional
developers as this is not particularly good code or even correct code. I am not
a brilliant programmer and do not aspire to elegant coding. However, because of
the difficulty I have had in getting anywhere with Linux, Qt, and KDevelop, I
have offered these lines in the hope that it will somehow aid you in your
journey and that you will not find all of the frustration that I have endured.
Please note, I do not blame these fine individuals who have produced these
tools, but I merely note that it remains sometimes difficult to get going. The
book "C++ GUI Programming with Qt 3" is highly recommended and was the final
guide that got me into their approach. The Qt Designer is actually quite easy
to use and there is excellent documentation on all of Qt. I keep the index page
in the browser always open so that I can confer on the class properties
immediately. There is abundant example code and example applications in the
documentation. Click to download and then if the Browser starts to load them
into the browser as a viewable page, hit stop and then select "File|Save As" to
place them in your location on your machine.Navigate to your local directory of
choice and untar and unzip these files with the shell command (from the shell
terminal window): tar -xzvf ColorPicker9.tar.gz or whatever file you have
downloaded. They will all appear in the relative path that includes the new
directory ColorPicker9 or whatever you have downloaded. Good luck. Last updated: 09/05/2007
This is a small application to illustrate the use of the Qt
approach and the KDE approach to building applications.
The approach is simple
enough. The framework will produce a main.cpp program element for you or you
can use one of the many examples. I recommend using a mainwindow approach so
that this is the main widget. Then introduce your central widget either
subclassed from QWidget or from a developed widget such as QTable.Thus, your
application will have a main.cpp, mainwindow.h, mainwindow.cpp, mywidget.h,
mywidget.cpp, and a project file. Except for main, these are place holder names
and you choose your own meaningful names. There is some important code to place
in the constructors and then procede with the QAction items and the menus and
toolbars and status bar. In the Qt paradigm, the code that you create is in the
signal/slot formalism so that you write slots (functions) to respond to signals
(some action taken such as a button clicked) emitted by widgets. There is also
important event programming to be done such as the paint event if you are
creating your own widget. Dialogs can be created in Designer, but you may also
create them from scratch much as you did your mainwindow application but derived
primarily from QDialog. Launching these from the mainwindow is thoroughly
documented in the discussion of dialogs in the Qt documentation.
The KDE
documentation may also be downloaded from their web site and contains
descriptions of all their main classes. There is not always example code given,
however. In other words, there is a QLabel widget and there is a corresponding
KLabel widget. Note that the KDE elements are derived from the Qt widget set.
It
is essential to first understand the Qt widget set and programming approach.
Then the migration to a modern IDE (KDevelop) will be easier.
I have not taken
the RAD approach here because if the form of this style is understood, then the
RAD approach will be easy to learn and the ability to subclass will be clear.
Only the most simple applications could only rely on existing properties of the
defined widgets and not require additional functionality obtained by subclassing
the widget.This application will introduce you to a fairly extensive number of
classes from the Qt class library (and also from KDE classes) and exercise some
of the important ones such as QString (qstring.h), QWidget (qwidget.h),
QApplication (qapplication.h) and more.
The code is given in two forms. One is
strictly the Qt development and the command line makes and compiles and
executes. The second is a KDevelop project in the IDE with a mixture of KDE and
Qt classes. The latter has the advantage of a graphical IDE with intrinsic
debugger and launcher. The former exhibits great simplicity, speed, and a
little more effort to launch but is actually quite pleasant to work with. I use
the Designer so far as to provide the code editor and keep track of files but
not directly for the mainwindow application in this example. It would be used
for dialog creation for the application as it now stands.
The best use of these
program elements is as a template for constructing your own classes and
applications following the pattern I have given. Currently, my approach is to start the project with a main and some other elements in Kate for example and use qmake. Then I migrate this to KDevelop to continue on with the project. Introduce new forms as you desire and rerun qmake as needed to update the Makefile. This is convenient for developing the code, running it, and rebuilding the project as needed. The output is convenient and you also have the file browser and Konsole available. The full KDE formalism is quite complicated and not needed unless you are going with all KDE widgets and want the KDE look and feel with other KDE capabilities.