hidden stateChanged() method

Olivier Goffart ogoffart at kde.org
Wed Jul 28 21:33:06 BST 2010


Le Wednesday 28 July 2010, Pedro Lopez-Cabanillas a écrit :
> Hi,
> 
> I've made a KPart in extragear/KMid implementing the KMediaPlayer
> interfaces [1], and the compiler complains with this message:
> 
> /usr/include/kxmlguiclient.h:326: warning: ‘virtual void
> KXMLGUIClient::stateChanged(const QString&,
> KXMLGUIClient::ReverseStateChange)’ was hidden
> /usr/include/KDE/KMediaPlayer/../../kmediaplayer/player.h:131: warning:
> by ‘void KMediaPlayer::Player::stateChanged(int)’
> 
> KParts::Part inherits from XMLGUIClient the stateChanged(const
> QString&,...) method, and KMediaPlayer::Player::stateChanged(int) is a
> signal.
> 
> I've tried XMLGUI states to work in my KMidPart, but they don't. So I've
> coded an alternative to enable/disable actions.
> 
> What do you think? I would like open a bug report, but I can't find any
> possible fix not implying a binary incompatibility.



gcc kindly warns you that, by naming your signal the same name as another 
function in the base class, you are hiding it, which you probably do not 
intent to.

The 'workaround' is to explicitly hide or enable it back with the 'using' 
keyword

put 
using KXMLGUIClient::stateChanged;
in the protected section of the KMediaPlayer::Player class

this does not break BC






More information about the kde-core-devel mailing list