[PyQt] Bug in QAction?

Hans-Peter Jansen hpj at urpla.net
Thu Apr 7 23:22:25 BST 2011


On Thursday 07 April 2011, 22:36:43 Vicent Mas wrote:
> 2011/4/7 Vicent Mas <uvemas at gmail.com>:
> > On 2011-04-07 "Hans-Peter Jansen" <hpj at urpla.net> said:
> >> On Thursday 07 April 2011, 12:12:48 Vicent Mas wrote:
> >> > Hi,
> >> >
> >> > I'm trying PyQt-x11-gpl-snapshot-4.8.4-8641ecc135b3 on a debian
> >> > testing box with Python2.7 and virtualenv-1.5.1. Running the
> >> > attached script raises the following error:
> >> >
> >> > (venv2.7)vmas at rachael:/tmp$ Traceback (most recent call last):
> >> >   File "test_qaction.py", line 9, in <module>
> >> >
> >> >     shortcut=QtGui.QKeySequence.New)
> >> >
> >> > TypeError: keyword arguments are not supported
> >> >
> >> > As far as I know the support of keyword arguments has not been
> >> > dropped so I suppose it is a bug. Am I right or am I missing
> >> > something?
> >>
> >> Did this worked in earlier versions? I don't use keyword arguments
> >> much, but according to the builtin help, QAction simply didn't
> >> define any
> >>
> >> [...]
> >
> > Hi,
> >
> > It works fine with PyQt4.8.3. The only documentation I know
> > regarding this is
> >
> > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/keyword_
> >arguments.html
> >
> > although it is not specific to QAction.
> >
> > Vicent
>
> Oops! I forgot to mention this one:
>
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qt_propert
>ies.html

Vicent, thanks for the reminder, and yes, something is busted here:

from PyQt4 import QtGui
app = QtGui.QApplication([])
act = QtGui.QAction('&Save', None, shortcut=QtGui.QKeySequence.Save)

Traceback (most recent call last):
  File "action.py", line 4, in <module>
    act = QtGui.QAction('&Save', None, shortcut=QtGui.QKeySequence.Save)
TypeError: keyword arguments are not supported

On the pride side, the pyqtConfigure() method works still:

from PyQt4 import QtGui
app = QtGui.QApplication([])
act = QtGui.QAction('&Save', None)
act.pyqtConfigure(shortcut=QtGui.QKeySequence.Save)

Pete

python: 2.6
sip: 4.12.2-snapshot-ec9807971e08
qt4: 4.7.1
pyqt4: snapshot-4.8.4-8641ecc135b3


More information about the PyQt mailing list