Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, April 2007
QtJambi: metacall failed


Message 1 in thread

Hi,
I switched to beta2 (from beta1) and following problem appeared:

I've got:

enum State;
Signal1<State> sig1;
Signal2<State,State> sig2;

connectineg sig1 to sig2 seems ok
sig2.connect( sig1 );

but when sig2 is emitted sig1 is NOT emitted and I receive this message:

QtJambi: metacall failed
Exception in thread "main" java.lang.IllegalArgumentException: wrong number
of arguments
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
com.trolltech.qt.QtJambiInternal$QMetaCallEvent.execute(QtJambiInternal.java:72)
        at com.trolltech.qt.gui.QApplication.exec(Native Method)
        at japla.Main.main(Main.java:23)

Am I doing something wrong, or is this a bug?

Jakub


Message 2 in thread

Jakub Dvorak wrote:
> Hi,
> I switched to beta2 (from beta1) and following problem appeared:
> 
> I've got:
> 
> enum State;
> Signal1<State> sig1;
> Signal2<State,State> sig2;
> 
> connectineg sig1 to sig2 seems ok
> sig2.connect( sig1 );
> 
> but when sig2 is emitted sig1 is NOT emitted and I receive this message:

Hi Jakub,

I don't get this message with the following example... Here I try all 
combinations of connecting enum-based signals to other signals and slots 
in the same thread and in other threads. Could you update it to 
reproduce the exact problem, maybe?

best regards,
Gunnar
package com.trolltech.tests;
package com.trolltech.tests;

import com.trolltech.qt.*;
import com.trolltech.qt.gui.*;

public class FailedMetaCall extends QSignalEmitter {

    public enum State {
        Reebo,
        Zooty
    };

    public Signal1<State> reebo = new Signal1<State>();
    public Signal2<State, State> zooty = new Signal2<State, State>();

    public static void main(String args[]) {
        QApplication.initialize(args);
        final FailedMetaCall meta = new FailedMetaCall();

        meta.reebo.connect(meta, "slot1(FailedMetaCall$State)");
        meta.zooty.connect(meta, "slot2(FailedMetaCall$State, FailedMetaCall$State)");

        System.out.println("From the same thread:");
        meta.reebo.emit(State.Reebo);
        meta.zooty.emit(State.Reebo, State.Zooty);

        System.out.println("From another thread...");
        Thread t = new Thread() {
                public void run() {
                    meta.reebo.emit(FailedMetaCall.State.Zooty);
                    meta.zooty.emit(FailedMetaCall.State.Zooty,
                                    FailedMetaCall.State.Reebo);
                }
            };
        t.start();
        try { t.join(); } catch (Exception e) { }
        QApplication.processEvents();

        System.out.println("Nested signals...");
        meta.zooty.connect(meta.reebo);
        meta.zooty.emit(FailedMetaCall.State.Reebo, FailedMetaCall.State.Zooty);

        System.out.println("Nested from thread...");
        Thread t2 = new Thread() {
                public void run() {
                    meta.zooty.emit(FailedMetaCall.State.Zooty,
                                    FailedMetaCall.State.Reebo);
                }
            };
        t2.start();
        try { t2.join(); } catch (Exception e) { }
        QApplication.processEvents();
    }


    public void slot1(State state) {
        System.out.println("slot1(" + state + ")");
    }

    public void slot2(State s1, State s2) {
        System.out.println("slot2(" + s1 + ", " + s2 + ")");
    }

}