This forum has been archived. All content is frozen. Please use KDE Discuss instead.

problem with adding new slots

Tags: None
(comma "," separated)
agforsyth
Registered Member
Posts
133
Karma
0

problem with adding new slots

Sat Aug 09, 2008 6:43 am
So, I'm trying to do some work on the media player plugin right now.

I want the video widget to have the current time and total time next to the SeekSlider.

So, I've added a QLabel in the constructor in videowidget.cpp, which I want to update whenever the mediaObject emits a tick, which you have set to happen ever second in mediaplayer.cpp.

So, I've added this:
Code: Select all
connect(player->media0bject(),SIGNAL(tick(bt::Uint64 time)),
      this,SLOT(updateTime(bt::Uint64 time)));


And updateTime() sets the text in the QLabel. It works fine when I call it from the constructor or onStateChanged().

However, it does not receive any tick signals. There are no compile / linking errors or warnings of any kind. The moc files also look correct. I've had this problem before, always when creating a new slot. If I connect the signal to an existing slot, it works.

The problem always just seems to go away without a reason, when I make clean or clear my ccache or something like that. This time, I've cleared my ccache and deleted my whole build directory without any luck.

Any suggestions? What am I missing / doing wrong?
George
Moderator
Posts
5421
Karma
1

Sun Aug 10, 2008 7:38 am
First of all, you shouldn't put the parameter name in the SIGNAL and SLOT macros.

Second, I had this problem to and managed to work around it by removing the generated automoc.cpp files. Since I upgraded to KDE4.1, I haven't seen it yet (though it could just be that I haven't added a slot since then).
agforsyth
Registered Member
Posts
133
Karma
0

Sun Aug 10, 2008 8:14 am
George wrote:First of all, you shouldn't put the parameter name in the SIGNAL and SLOT macros.

Second, I had this problem to and managed to work around it by removing the generated automoc.cpp files. Since I upgraded to KDE4.1, I haven't seen it yet (though it could just be that I haven't added a slot since then).


I've tried without the parameter, no luck. I've also tried removing the automoc, most times that works, not this time. I'll just try again and see, I guess. Like I said, this time I went as far as deleting the whole build directory without success.
George
Moderator
Posts
5421
Karma
1

Sun Aug 10, 2008 6:16 pm
phantom042 wrote:
George wrote:First of all, you shouldn't put the parameter name in the SIGNAL and SLOT macros.

Second, I had this problem to and managed to work around it by removing the generated automoc.cpp files. Since I upgraded to KDE4.1, I haven't seen it yet (though it could just be that I haven't added a slot since then).


I've tried without the parameter, no luck. I've also tried removing the automoc, most times that works, not this time. I'll just try again and see, I guess. Like I said, this time I went as far as deleting the whole build directory without success.


Strange, then there must be something wrong with the declaration of the slot, but if it is in the moc files and Qt doesn't complain on the command line it should be OK.
agforsyth
Registered Member
Posts
133
Karma
0

Sun Aug 10, 2008 6:58 pm
I've moved the connect command for the tick / updateTime pair over to mediaplayerplugin.cpp since I was able to add an action slot there before. Right where you create the video widget and have this:
Code: Select all
connect(video,SIGNAL(toggleFullScreen(bool)),this,SLOT(setVideoFullScreen(bool)));
I've added this:
Code: Select all
connect(media_player->media0bject(),SIGNAL(tick(Uint64)),video,SLOT(updateTime(Uint64)));
I did a make uninstall, cleared my ccache, deleted my build dir, moved the sources, rebooted, reran cmake, rebuilt, and reinstalled, but still not getting the tick.

Is there anything else caching that I don't know about? Does moc/automoc4 have a cache? Anything else that needs to know about the slot other than the moc files?
George
Moderator
Posts
5421
Karma
1

Mon Aug 11, 2008 7:02 pm
The signal tick of Phonon::MediaObject is defined with the parameter qint64, try that instead of Uint64, the moc thing probably needs exactly the same parameters.
agforsyth
Registered Member
Posts
133
Karma
0

Mon Aug 11, 2008 11:32 pm
George wrote:The signal tick of Phonon::MediaObject is defined with the parameter qint64, try that instead of Uint64, the moc thing probably needs exactly the same parameters.
Tried this, still no luck. Uint64 is just quint64, and the moc does a reinterpret cast thing, so it shouldn't make a difference anyway.

I posted the patch on bugzilla so you can try it and see if you get the same behavior as me, if you could.

EDIT: Tried deleting the moc files one more time, and now it's working. I'll assume it was the suggested change and keep that in mind for the future. Thanks.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]