PDA

View Full Version : Integrating Qt3 Designer with code based application



nleverin
25th June 2007, 08:56
Hi all,

Im trying to use Qt3 Designer to implement the .ui files only, and implement all signals / slots functionality etc in my subclasses so that i can port to Qt4 in the future.

I have been able to implement all the subclass functionality successfully, although when i try to make a connection within my subclass from a simple button on a form to display "button press" within a terminal window i get the following error:

error: no matching function for call to 'mainformsub::connect(QPushButton*&, const char [11], mainformsub* const, const char*)
candidates are: static bool QObject:: connect(const QObject*, const char*, const QObject*, const char*)

My connection string is as follows:
QObject::connect( pushButton1, SIGNAL (clicked()), this, SLOT( newSlot());

where newSlot is a function i have created in my subclass "mainformsub.cpp"

and pushbutton1 is a button i placed on my form.

Questions for the learned Qt Developers:

1) My idea was to create the .ui files within Qt designer and then create all the connections and slots etc within the subclass so i minimise the linkage with Qt Designer. Is this methodology sound?

2) The connection string i used (as above) is exactly the same as the auto generated connection string that is produce when running "uic -impl mainform.ui.h mainform.ui" and yet it does not compile when it is implemented within the subclass?

3) I have implemented my connection string within an initialise() function that is called within my subclass constructor, is this generally an appropriate place for the connection string.

ie mainformsub::mainformsub( xxx) : mainform
{
initialise()
}

void mainformsub::initialise()
{
QObject::connect( pushButton1, SIGNAL (clicked()), this, SLOT( newSlot());
}

Kind Regards

nlev.

jacek
26th June 2007, 21:59
error: no matching function for call to 'mainformsub::connect(QPushButton*&, const char [11], mainformsub* const, const char*)
candidates are: static bool QObject:: connect(const QObject*, const char*, const QObject*, const char*)
It seems that the compiler doesn't know what a QPushButton is. Try adding #include <qpushbutton.h>.

nleverin
27th June 2007, 10:23
Thanks mate, fixed the problems perfectly,

cheers,

nlev.