[Kde-bindings] [Bug 112409] New: overloading qt event handling methods in Java subclasses fails

Jochen Becher jochen_becher at gmx.de
Sun Sep 11 10:27:53 UTC 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=112409         
           Summary: overloading qt event handling methods in Java subclasses
                    fails
           Product: bindings
           Version: unspecified
          Platform: SuSE RPMs
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: kde-bindings kde org
        ReportedBy: jochen_becher gmx de


Version:            (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs
OS:                Linux

The following program defines a widget TestWidget which inherits from QWidget and overloads the event handler mouseReleaseEvent(). It also defines a widget TestWidget2 which inherits from TestWidget and overloads mousePressEvent(). Both widgets should handle the mouseReleaseEvent() but only TestWidget does. If you add a mouseReleaseEvent() to class TestWidget2 which calls the super-method than it works as expected. The calling of Java methods from the C++ wrapper code seems to be broken.


import org.kde.qt.QApplication;
import org.kde.qt.QCloseEvent;
import org.kde.qt.QMouseEvent;
import org.kde.qt.QWidget;
import org.kde.qt.qtjava;

/*
 * Created on 11.09.2005
 *
 */

public class QtTest {

    QApplication app;

    class TestWidget extends QWidget {
        public TestWidget() {
            super();
            resize(100,100);
            show();
        }

        protected void mouseReleaseEvent(QMouseEvent arg0) {
            System.out.println("release");
            super.mouseReleaseEvent(arg0);
        }
    }

    class TestWidget2 extends TestWidget {
        protected void closeEvent(QCloseEvent arg0) {
            System.out.println("quit");
            app.quit();
            super.closeEvent(arg0);
        }
        
        protected void mousePressEvent(QMouseEvent arg0) {
            System.out.println("press");
            super.mousePressEvent(arg0);
        }
        
    }
    
    public QtTest(String[] args) {
        app = new QApplication(args);
        TestWidget w = new TestWidget();
        TestWidget w2 = new TestWidget2();
        app.exec();
    }

    public static void main(String[] args) {
        qtjava.initialize();
        new QtTest(args);
    }

}



More information about the Kde-bindings mailing list