[Kdenlive-devel] Problems with signals and slots

Simon Eugster simon.eu at gmail.com
Wed Nov 24 08:42:23 UTC 2010


Good Morning,

I'm battling around with Qt's signals and slots. In r5116,
mainwindow.cpp:296 I want to connect my audiospectrum object to
Render::audioSamplesSignal. But whatever I do, my method never
receives the signal, although connecting works according to the return
value, Q_ASSERT etc.

On line 298 I tried to find a reason for it and used the audio volume
signal. It is defined as:
  void showAudioSignal(const QByteArray);
According to the Qt documentation and some people in #qt, Qt uses
normalizedSignature[1] for signal/slot connections. Meaning that I
should be able to just use
  SIGNAL(showAudioSignal(QByteArray))
to connect the signal. But then connecting fails, telling me that
there is no such signal.

I do not get an error though when using
  SIGNAL(showAudioSignal(const QByteArray)
i.e. the connection is set up correctly. Nevertheless the connected
slot is never called. Only if I use
  SIGNAL(showAudioSignal(const QByteArray&)
connecting works AND the slot gets called. Although the & is not in
showAudioSignal's signature.

So I tried to use the & for my signal (audioSamplesSignal) as well:
  audioSamplesSignal(const QVector<int16_t>&,int,int,int)
with
  void audioSamplesSignal(const QVector<int16_t>,int,int,int)
but this fails with «no such signal». Why should I have to add a & for
a QByteArray, but I'm forbidden to do so for the QVector?

I then tried to change everything (including the signal's signature)
to const type& (whether making sense or not – what I noticed above
does not make sense to me anyway). But still, no signal received.

Can anyone help me? Why is qt behaving that way? What is the problem?

thanks
Simon

[1] http://doc.qt.nokia.com/4.7/qmetaobject.html#normalizedSignature




More information about the Kdenlive mailing list