wbauer added a comment.

  In D24413#550948 <https://phabricator.kde.org/D24413#550948>, @heikobecker 
wrote:
  
  > I'm always easy to confuse about pointers and const, but isn't ec a const 
pointer to a const object? So calling ec->increaseVolume() as a non-const 
function) wouldn't really work outside a lambda either.
  
  
  Yes, exactly. Adding a line `ec->increaseVolume();` at that place gives the 
same compiler error:
  
    
/home/abuild/rpmbuild/BUILD/amarok-2.9.70git.20191004T143525~5ed62f9a08/src/MainWindow.cpp:
 In member function 'void MainWindow::createActions()':
    
/home/abuild/rpmbuild/BUILD/amarok-2.9.70git.20191004T143525~5ed62f9a08/src/MainWindow.cpp:904:24:
 error: passing 'const EngineController' as 'this' argument discards qualifiers 
[-fpermissive]
         ec->increaseVolume();
                            ^
  
  
  
  > What I'm not sure about is why it was done that way and why it does work 
with the new style connects.
  
  Apparently Qt's connect stuff "circumvents" the constness. It's not as if the 
function is actually being called here.
  
  I can't say why `ec` was declared const, but it was already the case in the 
KDE4 version (and it was no problem because it is only used to connect things 
to, with the old-style connect this particular issue with default arguments 
didn't exist either).
  
  Shall I just remove the const from ec then and connect to a lambda instead?

REPOSITORY
  R181 Amarok

REVISION DETAIL
  https://phabricator.kde.org/D24413

To: wbauer, #amarok, schweingruber
Cc: heikobecker, schweingruber, ognarb, amarok-devel, #amarok

Reply via email to