[Gllug] QT advise

Wenceslao Requejo W.Requejo at student.westminster.ac.uk
Mon Feb 19 09:41:06 UTC 2007


Hi everyone;

Just one question about Signals and slots...
Let me try to explain myself...
I am writing a QT3 application using Kdevelop and QT designer. Whenever
I create a new form (new *.ui file) I add it to the QMake Manager so it
is part of the "project". After that, and when the project is built, the
compiler generates three other files. i.e. if the form is called
main_window.ui, it generates the files main_window.h, main_window.cpp
and moc_main_window.cpp witch are the implementation files for that form
or ui file. Up to there everything is fine. Now, on the files
main_window.cpp and .h very clearly states that 

"** WARNING! All changes made in this file will be lost!"
 and when the project is rebuilt, the changes are lost indeed. 
One alternative way I found and used for a small error Dialog is to
create the errorBaseDialog ui file and class, and then create an error
class (error.h) subclass of errorBaseDialog and implement any specific
features on it. This is quite simple because is a small dialog with just
on button and one signal.

On the main_window.h and .cpp is a bit different, as it has many
signals. So here it comes my question. 
What is the best approach then to implement and use a object of the clas
main_windo.h (i.e. A main window)?
	a) Write the code needed on the signals or callbacks on main_window.cpp
and "hope" that somehow the compiler will not overwrite this changes
within the signal functions. OR
	b) Create a new sub class of main_window.h and "redefine" the slots or
callbacks as needed.
Please asume that the slots or callbacks will need to do a bit more than
closing the window. i.e. objects, dialogs and other functions from other
classes should be called from them.

Many thanks, and sorry if I didn't explain myself properly. 


Wenceslao Requejo


-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list