[Kde-bindings] Qt signal return values
Richard Dale
richard.j.dale at gmail.com
Thu Oct 5 22:09:26 UTC 2006
On Wednesday 11 October 2006 00:24, Arno Rehn wrote:
> Am Mittwoch, 11. Oktober 2006 00:26 schrieb Arno Rehn:
> > And how should I get the arguments Q_CLASSINFO into the QMetaObject?
> >
> > The core QMetaObject-data is set up here:
> >
> > ArrayList tmp = new ArrayList(new uint[] {
> > 1, // revision
> > handler[className], // classname
> > 0, 0, // classinfo
> > (uint)(signals.Count + slots.Count), 10, // methods
> > 0, 0, // properties
> > 0, 0
> > });
> >
> > The equivalent in QtRuby is:
> > data = [1, # revision
> > string_table.call(classname), # classname
> > classinfos.length, classinfos.length > 0 ? 10 : 0, # classinfo
> > signals.length + slots.length,
> > 10 + (2*classinfos.length), # methods
> > 0, 0, # properties
> > 0, 0] # enums/sets
> >
> > Quite clear, but (I'm not that good in ruby) what does
> > classinfos.length > 0 ? 10 : 0
> > mean? Of what type is "classinfos"?
> > Then it still seems as only the length of "classinfos" is passed, but not
> > the parameters...
>
> OK, after some more looks on QtRuby code this also clear :-)
> Still I wonder were to put Q_SCRIPTABLE. Should it be implemented as an
> attribute to a class or to a signal/slot?
As a an attribute for signals/slots, for example:
[Q_SCRIPTABLE()]
[Q_SLOT("void setValue(int)")]
public void SetValue(int value) {
slider.SetValue(value);
}
public interface ILCDRangeSignals : IQWidgetSignals {
[Q_SCRIPTABLE()]
[Q_SIGNAL("void valueChanged(int)")]
void ValueChanged(int newValue);
}
In QtRuby there isn't currently a way of specifying whether a slot is
scriptable or not, so if it finds a QDBus q_classinfo declaration for a class
it makes all the slots and signals scriptable. For Qyoto we just need to have
a condition like this to set the flags for slots/signals according to
Q_SCRIPTABLE:
if dbus
data.push MethodScriptable | MethodSignal | AccessPublic
else
data.push MethodSignal | AccessProtected # flags, always
protected for now
end
-- Richard
More information about the Kde-bindings
mailing list