Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
sender does nothing
when i play the song i dont get any output, it should output "Test" every milliseconds
qDebug() << "Test":
test the return of connect
and maybe give test a qint64 parameter since your signal has.
void MyMusicPlayer::test( qint64 pos)
test() dont need a parameter
if connect returns false then check you have
Q_OBJECT in your class.
i have all the prerequisite to use connect
if i set the connection from mainwindow it works fine.
i dont know why,but i want to connect it inside the mymusicplayer for cleanliness
There are only two cases in which slots is not executed.
- You made connect statement. But signal itself is not sent.
- Connect itself is not done.
By looking at your explanation, it works when you do this connection in MainWindow but not in other.
This tells me your connect in other place is not executed. If executed you audio object which you are using is not emitting the signal.
Please check both.
@dheerendra sorry for the late reply i was so busy in school projects
in case #1 i dont have any idea why a signal will not be sent.
what do you mean by case #2?
- You need to see whether code and object which is emitting the signal is really executed.
- Also this is the object which is emitting the signal is really connected to destination object. Some times due to coding mistake object which is emitting the signal is different from object which we use in connect statement.
- See if the connect code itself is executed or not.
Cool. As i said earlier it is either of the three issue which I highlighted in my ans. Now you can move this question to solved state. If my answer helped you to solve the problem you can up-vote.
Enjoy Qt Programming.