[PyKDE] problem with pyqtref manual code

simon stockes simonstockes at gmail.com
Mon Nov 13 16:00:50 GMT 2006


Hi and thank a lot for your help,

You'r right.
I forgot these lines

app = QtGui.QApplication(sys.argv)
window = ImageDialog()
window.show()
sys.exit(app.exec_())

But there is another problem. The code produced by "designer" Qt-4.2.1 is
not compatible with Qt-4.1.4 !! QDialogButtonBox is new in Qt-4.2 !!

Also, be carefull to comment also in ui_imagedialog.py this line

#self.ui.colorDepthCombo.addItem("2 colors (1 bit per pixel)")

Bye, Simon.


2006/11/11, Phil Thompson <phil at riverbankcomputing.co.uk>:
>
> On Friday 10 November 2006 3:43 pm, simon stockes wrote:
> > Hi,
> >
> > With the pyqtref manual, I try to test base2.py (see below the code).
> But
> > this one does not produce anything !!
> > Is it the same for you ?
> >
> > Simon
> >
> > Config : rhel4, pyqt-4.0.1, qt4.1.4
> >
> >
> >
> > Base2.py
> > =======
> >
> > from PyQt4 import QtCore, QtGui
> > from ui_imagedialog import Ui_ImageDialog
> >
> > class ImageDialog(QtGui.QDialog):
> >     def __init__(self):
> >         QtGui.QDialog.__init__(self)
> >
> >         # Set up the user interface from Designer.
> >         self.ui = Ui_ImageDialog()
> >         self.ui.setupUi(self)
> >
> >         # Make some local modifications.
> >         self.ui.colorDepthCombo.addItem("2 colors (1 bit per pixel)")
> >
> >         # Connect up the buttons.
> >         self.connect(self.ui.okButton, QtCore.SIGNAL("clicked()"),
> >                      self, QtCore.SLOT("accept()"))
> >         self.connect(self.ui.cancelButton, QtCore.SIGNAL("clicked()"),
> >                      self, QtCore.SLOT("reject()"))
> >
> > ui_imagedialog.py
> > =============
> >
> > import sys
> > from PyQt4 import QtCore, QtGui
> >
> > class Ui_ImageDialog(object):
> >     def setupUi(self, ImageDialog):
> >         ImageDialog.setObjectName("ImageDialog")
> >         ImageDialog.resize(QtCore.QSize(QtCore.QRect
> > (0,0,420,300).size()).expandedTo(ImageDialog.minimumSizeHint()))
> >
> >         self.buttonBox = QtGui.QDialogButtonBox(ImageDialog)
> >         self.buttonBox.setGeometry(QtCore.QRect(30,240,341,32))
> >         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
> >         self.buttonBox.setStandardButtons(
> >
> QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialog
> >ButtonBox.Ok )
> >         self.buttonBox.setObjectName("buttonBox")
> >
> >         self.retranslateUi(ImageDialog)
> >         QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL
> ("accepted()"),
> > ImageDialog.accept)
> >         QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL
> ("rejected()"),
> > ImageDialog.reject)
> >         QtCore.QMetaObject.connectSlotsByName(ImageDialog)
> >
> >     def retranslateUi(self, ImageDialog):
> >
> > ImageDialog.setWindowTitle(QtGui.QApplication.translate("ImageDialog",
> > "Dialog", None, QtGui.QApplication.UnicodeUTF8))
>
> Is this the complete application? If so, then yes, it does the same for me
> -
> because you haven't created the QApplication instance, entered the event
> loop
> etc, etc.
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061113/8c051934/attachment.html


More information about the PyQt mailing list