[Kde-games-devel] KMahjongg frameworks branch

Albert Astals Cid aacid at kde.org
Wed Nov 18 20:17:16 UTC 2015


El Wednesday 18 November 2015, a les 16:46:24, Ian Wadham va escriure:
> 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.

Why would signals with paramaters go wrong and disconnects fail?

Cheers,
  Albert

> 
> Cheers, Ian W.
> 
> _______________________________________________
> kde-games-devel mailing list
> kde-games-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-games-devel



More information about the kde-games-devel mailing list