How to check if a Mainwindow button is clicked from main.cpp?
Is there any way to check if t开发者_Python百科he Mainwindow button is clicked from main.cpp? I want to excecute the following line when I pressed the Play button of Mainwindow:
pipe = popen("mplayer -slave '/home/cinesoft/Desktop/yamuna/songs/first.3gp' &", "w");
I also want the following line to execute when the pause button is pressed:
fputs("pause\n", pipe);
bjoernz is right. You need to use the Signals and Slots mechanisms built into QT.
Why can't you execute that code in the Mainwindow.cpp class instead of main.cpp? Would make life a lot easier.
You may want to look under Signals & Slots on this page: Programming with Qt
Cross-Platform Applications using Qt is also a good reference for Qt programming.
精彩评论