Re: [PyQt] Image doesn't show up

2011-06-25 Thread Hans-Peter Jansen
On Saturday 25 June 2011, 06:57:05 Algis Kabaila wrote:

 But how to change the old style signal/slot statement to the new
 style?...

exit.triggered.connect(self.close) 

perhaps?

Pete
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Image doesn't show up

2011-06-25 Thread Algis Kabaila
On Sat, 25 Jun 2011 09:49:26 PM Hans-Peter Jansen wrote:
 On Saturday 25 June 2011, 06:57:05 Algis Kabaila wrote:
  But how to change the old style signal/slot statement to the new
  style?...
 
   exit.triggered.connect(self.close)
 
 perhaps?
 
 Pete

Yes, and QtCore is not used, so not required.  The script becomes:

#!/usr/bin/python
# menubar.py
 
import sys
from PyQt4 import QtGui

class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)

self.resize(250,150)
self.setWindowTitle('menubar')

exit = QtGui.QAction(QtGui.QIcon('icons/no.png'),'Exit',self)
exit.setShortcut('Ctrl+Q')
exit.setStatusTip('Exit application')
#
self.connect(exit,QtCore.SIGNAL('triggered()'),QtCore.SLOT('close()'))
exit.triggered.connect(self.close)
self.statusBar()
menubar = self.menuBar()
file = menubar.addMenu('File')
file.addAction(exit)

app = QtGui.QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec_())

IMHO it is neater.  Here is a cigar, Pete!

OldAl.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt