[PyQt] QAction, signals, eric4, Windows and Linux...
David Boddie
david at boddie.org.uk
Tue Aug 24 23:33:14 BST 2010
On Mon Aug 23 20:07:26 BST 2010, fpp wrote:
> On a hunch I looked at the (Py)Qt documentation for QAction -- which
> I'd never had to do before because everything was automated by
> Designer/eric4.
>
> And the strange thing is, if I read correctly, QActions have an
> "activate()" method, but no "activated()" signal ?
>
> Their only signals are: changed(), hovered(), toggled(),
> triggered()... the latter being described as "emitted when an action
> is activated by the user". Duh.
The activated() signal is a "Qt 3 support member" of QAction:
http://doc.qt.nokia.com/latest/qaction-qt3.html
This means that it is available if Qt has been built to contain code to
support APIs in Qt 3, to help people port applications from Qt 3 to Qt 4.
I guess the version of Qt for Maemo doesn't contain this code, so it won't
work.
> So I changed the slot name to on_actionOpen_triggered(), and sure
> enough the code now works both under XP and Maemo...
>
> So I've found a reason, but not really the cause, and am left with
> more questions than I started with:
>
> - is eric4 wrong about the QAction "activated()" signal ?
No, but it really should be generating triggered() instead.
> - if so, why does it work under Windows ?
The legacy signal is there, and QMetaObject.connectSlotsByName() will
find it.
> - does it also work under "standard" desktop Linux ?
Yes, I think so.
> - or is it a specific Qt/PyQt bug in Maemo ?
No. I believe the lack of Qt 3 support is intentional.
David
More information about the PyQt
mailing list