[Qt-jambi-interest] Error on connecting QCheckBox.toggled with QDialog.setVisible(boolean)

Curt Nowak cnowak at bwl.uni-hildesheim.de
Thu Jul 3 16:58:14 CEST 2008


Hi everyone,
 
I'm trying to toggle the visibility of a QDialog 'dialog' when a QCheckBox 'checkBox' is toggled.
So I thought
 
<code>
checkBox.toggled.connect(dialog, "setVisible(boolean)");
</code>
 
would do the trick. But instead I get a com.trolltech.qt.QNoSuchSlotException.
Misteriously 
 
<code>
checkBox.toggled.connect(dialog, "setEnabled(boolean)");
</code>
 
works fine. What's up with that?
Again, I attached a very small program to demonstrate what I mean. Of course, the workaround is easily done. I'm just curious.
Thanks for any hints,
 
Curt
 
 
import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.gui.QCheckBox;
import com.trolltech.qt.gui.QDialog;
import com.trolltech.qt.gui.QWidget;

public class ConnectSample
{
    public static void main(String[] args)
    {
        QApplication.initialize(args);
        QWidget dialog = new QDialog(null);
        QCheckBox checkBox = new QCheckBox();
        checkBox.toggled.connect(dialog, "setEnabled(boolean)");                
        checkBox.toggled.connect(dialog, "setVisible(boolean)");                // Bang!
        dialog.show();
        QApplication.exec();
    }
}





More information about the Qt-jambi-interest mailing list