hidden stateChanged() method

Pedro Lopez-Cabanillas pedro.lopez.cabanillas at gmail.com
Wed Jul 28 22:51:14 BST 2010


On Wednesday, July 28, 2010, Olivier Goffart wrote:
> 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

Many thanks! it works!

> this does not break BC

Should I make a patch, and open a review request for it?

Regards,
Pedro




More information about the kde-core-devel mailing list