[PyQt] Custom Widgets and __pyqtSignals__
david at boddie.org.uk
Sun Aug 24 15:34:44 BST 2008
On Sun Aug 24 12:43:33 BST 2008, Paul Giannaros wrote:
> On Sun, Aug 24, 2008 at 12:03 PM, himork <himork at kth.se> wrote:
> > I am trying to write a custom widget in python/pyqt to be used inside
> > QtDesigner. Everything seems to work fine (i followed the tutorials and
> > examples available), except for the signals: when I use __pyqtSignals__ =
> > ("mysignal(double)"), the widget ends up having one signal for each
> > letter of "mysignal(double)", parenthesis included, like it cannot
> > understand that this is a string.
Paul's explanation is correct. This is an interesting side effect of the
fact that PyQt accepts any kind of sequence for __pyqtSignals__.
> > And if I had 2 signals, designer crashes when I try to add my custom
> > widget.
Can you say what you wrote for __pyqtSignals__ in that case? I would be
interested to know why it caused a crash.
> I think you may want a comma to turn that string into a tuple, e.g
> __pyqtSignals__ = ("mysignal(double)",)
> Python will just think that your brackets are there for the sake of
> precedence modification otherwise.
It's a common mistake to make (even for those of us who have been writing
in Python for years).
More information about the PyQt