[PyKDE] QAssistantClient and PyQt

Phil Thompson phil at riverbankcomputing.co.uk
Wed Jun 4 20:39:00 BST 2003


On Wednesday 04 June 2003 6:01 pm, Peter Kropf wrote:
> I'm a bit confused about a problem that I'm having when using
> QAssistantClient from a Python program. Here's a snippet of the code that
> I'm using to test things out.
>
> import sys
> from qt import *
>
> class LaunchButton( QPushButton ):
>     def __init__( self, *args ):
>         apply( QPushButton.__init__, (self,) + args )
>         self.setText( "Launch" )
>
>
> class TheWindow( QMainWindow ):
>     def __init__( self, *args ):
>         apply( QMainWindow.__init__, (self,) + args )
>
>         self.button=LaunchButton( self )
>         self.setCentralWidget( self.button )
>         self.connect( self.button, SIGNAL( "clicked()" ), self.BeenClicked
> )
>
>         self.qac = QAssistantClient( '' )
>         self.connect( self.qac, SIGNAL( "destroyed()" ),
> self.qacDestroyed )
>         self.connect( self.qac, SIGNAL( "assistantOpened()" ),
> self.qacOpened )
>         self.connect( self.qac, SIGNAL( "assistantClosed()" ),
> self.qacClosed )
>         self.connect( self.qac, SIGNAL( "error()" ),          
> self.qacError )
>
>         self.toggle = True
>
>     def qacDestroyed( self ):
>         print 'qacDestroyed'
>
>     def qacOpened( self ):
>         print 'qacOpened'
>
>     def qacClosed( self ):
>         print 'qacClosed'
>
>     def qacError( self ):
>         print 'qacError'
>
>     def BeenClicked( self ):
>         if self.toggle:
>             page = '/tools/qt/doc/html/assistant.html'
>             self.toggle = False
>         else:
>             page = '/tools/qt/doc/html/assistant-4.html#3'
>             self.toggle = True
>         print 'Been clicked: ' + page
>         self.qac.showPage( page )
>
>
> def main(args):
>     app=QApplication( args )
>
>     win=TheWindow( )
>     win.show( )
>
>     app.connect( app, SIGNAL( "lastWindowClosed()" ), app, SLOT( "quit()" )
> )
>     app.exec_loop()
>
>
> if __name__=="__main__":
>     main( sys.argv )
>
>
> My problem occurs when connecting the error signal to a slot. At runtime, I
> receive these messages:
>
> QObject::connect: No such signal QAssistantClient::error()
> QObject::connect:  (sender name:   'unnamed')
> QObject::connect:  (receiver name: 'unnamed')
>
> But when I look through the QAssistantClient.cpp and
> sipqtQAssistantClient.cpp code, the error signal looks to be defined the
> same way the destroyed, assistantOpened and assistantClosed signals. What
> am I missing?

The signal's argument, ie. SIGNAL("error(const QString &)").

Phil




More information about the PyQt mailing list