[Kdenlive-devel] Problems with signals and slots

Marco Gittler marco at gitma.de
Wed Nov 24 12:35:18 UTC 2010


HI

the & is required to copy only the const reference for the object.
else you would make a const copy (maybe the compiler will correct this to const &, since it is for the usage the same).
but this was not the problem with the signals, it was the diff in the mainwindow.cpp at top.

regards marco

Am 24.11.2010 um 12:37 schrieb Simon Eugster:

> Hey Marco,
> 
> Thanks! Working here.
> Why is the & required? Did you just use trial&error, or is there a
> rule that makes sense?
> 
> Simon
> 
> 2010/11/24 Marco Gittler <marco at gitma.de>:
>> Hi
>> 
>> I used the new (your) signals with QVector and rewrote the audiosignal.cpp (commited to svn)
>> 
>> regards marco
>> 
>> Am 24.11.2010 um 11:10 schrieb Simon Eugster:
>> 
>>> Well, the «old» signal (using volume) _does_ work, but I cannot explain why.
>>> When I try to do the same with my new signal, it does not work.
>>> 
>>> Simon
>>> 
>>> 2010/11/24 Marco Gittler <marco at gitma.de>:
>>>> Hi
>>>> 
>>>> I'll change this, to get it working (first on the "old" audiosignal)
>>>> You can use this then for your audiospectrum.
>>>> 
>>>> 
>>>> regards marco
>>>> 
>>>> Am 24.11.2010 um 09:42 schrieb Simon Eugster:
>>>> 
>>>>> 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
>>>>> 
>>>>> ------------------------------------------------------------------------------
>>>>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>>>>> Tap into the largest installed PC base & get more eyes on your game by
>>>>> optimizing for Intel(R) Graphics Technology. Get started today with the
>>>>> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
>>>>> http://p.sf.net/sfu/intelisp-dev2dev
>>>>> _______________________________________________
>>>>> Kdenlive-devel mailing list
>>>>> Kdenlive-devel at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/kdenlive-devel
>>>> 
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>>>> Tap into the largest installed PC base & get more eyes on your game by
>>>> optimizing for Intel(R) Graphics Technology. Get started today with the
>>>> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
>>>> http://p.sf.net/sfu/intelisp-dev2dev
>>>> _______________________________________________
>>>> Kdenlive-devel mailing list
>>>> Kdenlive-devel at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/kdenlive-devel
>>>> 
>>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>>> Tap into the largest installed PC base & get more eyes on your game by
>>> optimizing for Intel(R) Graphics Technology. Get started today with the
>>> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
>>> http://p.sf.net/sfu/intelisp-dev2dev
>>> _______________________________________________
>>> Kdenlive-devel mailing list
>>> Kdenlive-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/kdenlive-devel
>> 
>> 
>> ------------------------------------------------------------------------------
>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>> Tap into the largest installed PC base & get more eyes on your game by
>> optimizing for Intel(R) Graphics Technology. Get started today with the
>> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
>> http://p.sf.net/sfu/intelisp-dev2dev
>> _______________________________________________
>> Kdenlive-devel mailing list
>> Kdenlive-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/kdenlive-devel
>> 
>> 
> 
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Kdenlive-devel mailing list
> Kdenlive-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3910 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdenlive/attachments/20101124/3d4b3c12/attachment.p7s>


More information about the Kdenlive mailing list