[Kde-games-devel] KMahjongg frameworks branch

Ian Wadham iandw.au at gmail.com
Wed Nov 18 05:46:24 UTC 2015


Hi Frederik,

On 18/11/2015, at 10:13 AM, Ian Wadham wrote:

> On 18/11/2015, at 10:06 AM, Frederik Schwarzer wrote:
>> Ok, first stumbling block.
>> While porting to the newer connect() syntax, some calls in GameView 
>> give me compile errors and I do not see the problem.
>> 
>> diff --git a/GameView.cpp b/GameView.cpp
>>    // Connections
>> -    connect(scene(), SIGNAL(selectionChanged()), this, 
>> SLOT(selectionChanged()));
>> +    connect(scene, &GameScene::selectionChanged, this, 
>> &GameView::selectionChanged);
> 
> Do you still need the full signature?  &GameScene::selectionChanged()?

No (https://wiki.qt.io/New_Signal_Slot_Syntax), but I think you still need scene().
It is a function returning a pointer to the GameScene object.  See GameView.h.
So the following should compile OK with Qt5…
    connect(scene(), &GameScene::selectionChanged, this,
    &GameView::selectionChanged);

Is there any real need to change this syntax?  Apparently the old syntax is
supported by Qt5.  Also I am worried that, in old code such as most KDE
Games, signals with parameters might go wrong and automatic disconnects
might fail when an object is destroyed.

Cheers, Ian W.



More information about the kde-games-devel mailing list