qt-interest@trolltech.com
[Top] [All Lists]

Re: [Qt-interest] Creating a new slot with qtcreator

Subject: Re: [Qt-interest] Creating a new slot with qtcreator
From: Arnold Krille
Date: Sat, 20 Jun 2009 09:58:46 +0200
Hi,

On Friday 19 June 2009 01:57:07 Svenn Are Bjerkem wrote:
> I'm following "The independent Qt Tutorial" address book example on
> http://www.digitalfanatics.org/projects/qt_tutorial/chapter07.html and
> obviously this tutorial is using Qt Designer and an older version of
> Qt, but I wanted to take the challenge to re-perform it in qtcreator.
> Now I am a bit stuck on the part where the addContact() slot is
> supposed to be created. From a search on google it looks as if there
> is no way of defining a new slot the way Qt Designer does it in this
> tutorial.

The way ui-files (these things created in the designer) work has changed quite 
a bit from qt3 to qt4.
With qt3 you had to subclass from the class created in the designer. And 
therefor the designer allowed the direct creation of code (signals and slots).
With Qt4 the designer creates a class, but that is _really_ lightweight. And 
you don't subclass from it alone, but at least also from the real base-class 
of your widget/window. And all the manual code adding is completely gone from 
designer in qt4.

To execute code upon certain signals without manually connecting the 
signals/slots, use the automatic connection mechanism, that is in your derived 
class define a slot on_ObjectName_signalName() where you do the stuff.

I am probably not that good at explaining it, but the Qt documentation is. I 
suggest you start by reading it. It also has some good examples and 
tutorials...

Have fun,

Arnold
_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest
<Prev in Thread] Current Thread [Next in Thread>