[PyKDE] QAssistantClient and PyQt
Hans-Peter Jansen
hpj at urpla.net
Wed Jun 4 21:21:01 BST 2003
Hi Peter,
On Wednesday 04 June 2003 19:01, 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.
[...]
> 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?
Since Phil was quicker, here is just the fixed source:
import sys
from qt import *
DOCBASE = "/usr/lib/qt3/doc/html"
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(const QString &)" ), self.qacError )
self.toggle = True
def qacDestroyed( self ):
print 'qacDestroyed'
def qacOpened( self ):
print 'qacOpened'
def qacClosed( self ):
print 'qacClosed'
def qacError( self, msg ):
print 'qacError:', msg
def BeenClicked( self ):
if self.toggle:
page = DOCBASE + '/assistant.html'
else:
page = DOCBASE + '/assistant-4.html#3'
self.toggle = not self.toggle
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 )
More information about the PyQt
mailing list