You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

cbarmpar

Beginner

  • "cbarmpar" is male
  • "cbarmpar" started this thread

Posts: 31

Location: Athens

  • Send private message

1

Friday, August 29th 2008, 3:32pm

Why do i need to declare a function as a slot?

Hello all,

I am new to c++, linux and and qt!

What I don't understand is why I need to declare a function as a public slot in order to connect it with a signal.

Is it possible to connect a public function (not declared as a slot) with a signal?.

Does that means that if I want to connect a function with a signal I have to declare it as a slot before?

How can i connet more than one function with a signal. (for example if condition a exist execute the first function otherwise execute the second)?

Finaly: All the tutorials i have been through were using the code generation technique for the GUI. If i use the designer i only need to bother about the connection right?

Many thanks in advance,

Christos

CrazyOrc

Beginner

  • "CrazyOrc" is male

Posts: 34

Location: Belarus

  • Send private message

2

Friday, August 29th 2008, 6:45pm

Usually you need to declare fuction as slot only to denote that it will be used as slot (in Qt). Probably moc also uses this keyword. Actually slot Qt keyword is defined in header files as empty.

cbarmpar

Beginner

  • "cbarmpar" is male
  • "cbarmpar" started this thread

Posts: 31

Location: Athens

  • Send private message

3

Tuesday, September 2nd 2008, 7:02pm

thank you!