[Kde-bindings] Qyoto Custom Signal Arguments

Arno Rehn arno at arnorehn.de
Tue Sep 5 19:46:52 UTC 2006


Am Montag, 4. September 2006 13:49 schrieb Richard Dale:
> On Sunday 03 September 2006 18:17, Arno Rehn wrote:
> > > Ruby program attached.
> > > Why isn't emitSignal() called?
> >
> > Oh sorry, I forgot about
> > "but you can't emit existing c++ signals in QtRuby like you can in Qyoto,
> > only ruby signals."
> > Sorry again. Then I'll have to declare my own signals.
>
> Yes, just redeclare the signal in the MySlider class like this, and it
> should work ok:
>
> class MySlider < Qt::Slider
>         signals 'valueChanged(int)'
>
> 	def initialize(parent)
> 		super(parent)
> 	end
>
> 	def Emit()
> 		emit(valueChanged(5))
> 	end
> end

Now, to get back to the topic: I didn't get any step further till now. But 
there is a thing that confuses me:
The constructor of EmitSignal is:

    EmitSignal(QObject *qobj, int id, int items, MocArgument * args, 
Smoke::StackItem *sp) :
    _qobj(qobj), _id(id), _sp(sp), _items(items), _args(args),
    _cur(-1), _called(false)
    {
	_stack = new Smoke::StackItem[_items];
    }

Here we create a new pointer to a Array of StackItem-Structures. As far as I 
know, the structures shouldn't contain any values by now. But later we use 
the array again, without filling it with any values:

    Smoke::StackItem *si = _stack + i;
    switch(_args[i].argType) {
    case xmoc_bool:
      o[i + 1] = &si->s_bool;
      break;
    case xmoc_int:
      o[i + 1] = &si->s_int;
      break;

I've seen this many times in qtruby, too. Now my question is, where do the 
values come from?

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list