FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Usage of SLOT

 
Post new topic   Reply to topic     Forum Index -> QtD
View previous topic :: View next topic  
Author Message
Andrej08



Joined: 31 Aug 2010
Posts: 51

PostPosted: Sat Mar 12, 2011 6:25 pm    Post subject: Usage of SLOT Reply with quote

I'm trying to port the screenshot example to D2, but I'm stuck on this line:
Code:
QTimer.singleShot(delaySpinBox.value() * 1000, this, SLOT(shootScreen()));


I can only find SLOT in qtd\d2\qt\QObjectDefs.d:
Code:
char[] SLOT( char[] a ) { return "1"~a; }


But importing it fails as there's this import in the module:
Code:
//import qt.core.QGlobal;
//import qt.core.Qt;
import QGlobal;


In any case I'm not sure how this is supposed to work? I can't pass an invocation of void method to a method expecting a char[]. And how does prepending "1" help?

It's hard to figure this stuff out without any comments..
Back to top
View user's profile Send private message
mweber1488



Joined: 10 Jun 2008
Posts: 15

PostPosted: Sat Mar 12, 2011 9:17 pm    Post subject: Reply with quote

SLOT is just macro that wraps the parameter in quotes so you would use:
Code:
QTimer.singleShot(delaySpinBox.value() * 1000, this, "shootScreen");
Note that for the most part you do not need to tell qtd the slot parameters so for example QAbstractButton::checked(bool) would become
Code:
connect(someObject, "some_signal", someButtonObject, "checked");
The opengl example in the qtd package shows how qtd does signals and slots pretty well.
Back to top
View user's profile Send private message
Andrej08



Joined: 31 Aug 2010
Posts: 51

PostPosted: Sat Mar 12, 2011 10:24 pm    Post subject: Reply with quote

Thanks, I'll have a look there.

One more thing, when is it necessary to use mixin Q_OBJECT; ? Do I need it for all classes deriving from a QtD class?
Back to top
View user's profile Send private message
mweber1488



Joined: 10 Jun 2008
Posts: 15

PostPosted: Sun Mar 13, 2011 8:34 am    Post subject: Reply with quote

If your using the meta object system, then yes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> QtD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group