[PyKDE] PyQt4, my approach was wrong before or now?

V. Armando Sole sole at esrf.fr
Sun Mar 5 13:41:10 GMT 2006


Hi!

In order to be able to use the same code with PyQt3 and PyQt4, I had 
written a small Qt4.py  wrapper to simplify simple cases.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
QIconSet = QIcon
QWMatrix = QMatrix
print "Qt.Vertical = ", Qt.Vertical
print "QSplitter   = ", QSplitter
QSplitter.Vertical = Qt.Vertical
Qt.WDestructiveClose = Qt.WA_DeleteOnClose
class QPopupMenu(QMenu):
     def insertItem(self, *var):
         QMenu.addAction(self,*var)


if __name__ == "__main__":
     print "test passed"


The goal was to be able to type:
try:
    import Qt4 as qt
except:
    import qt

in my code in order to get the source independent of a PyQt3 or a PyQt4 
installation.

My problem is the above code was working till the 20060218 snapshot 
inclusive. However, later snapshots do not allow it giving an error about 
Vertical not being an attribute of Qt. My question is if the code should 
never have worked.

Thanks,

Armando




More information about the PyQt mailing list