[PyQt] New Feature - Keyword Arguments for Properties and Signals

Ville M. Vainio vivainio at gmail.com
Wed Sep 9 23:25:12 BST 2009


Accidentally omitted list in CC, resending...


On Mon, Sep 7, 2009 at 10:57 AM, Phil Thompson
<phil at riverbankcomputing.com> wrote:

> For example, the following calls...
>
>    act = QAction("Save", parent)
>    act.setShortcut(QKeySequence.Save)
>    act.setStatusTip("Save the document")
>    act.triggered.connect(self.save)
>
> ...can be replaced by...
>
>    act = QAction("Save", parent, shortcut=QKeySequence.Save,
>            statusTip="Save the document", triggered=self.save)

Very cool stuff!

Now, can we have something that does the same thing outside constructor? E.g.

act = menu.addAction('blah')
act.configure(triggered=self.save, statusTip="Save the document")

Also, is this a "safe" way to connect signals so that we get an
exception on bad signal name (as in the new style signal api, and as
opposed to the old c++ style signal binding)?

--
Ville M. Vainio
http://tinyurl.com/vainio



-- 
Ville M. Vainio
http://tinyurl.com/vainio



More information about the PyQt mailing list