I have Qt SDK and Visual Studio Qt Add-In working in VS2008. I created Qt UI project with main window class MainWindow. Double-click on mainwindow.ui opens Qt Designer. Then I added push button to the window, and called it pushButton. In Signals-Slots mode I managed to connect button's clicked signal with MainWindow ButtonClicked slot. Signal/Slot editor looks like this:
Sender pushButton Signal clicked() Receiver MainWindowClass Slot ButtonClicked()
mainwindow.ui file was changed, reflecting this new information. However, mainwindow.cpp and mainwindow.h remain unchanged. I expect to see the place where I can add my own code. So, I added this code manually:
// mainwindow.h ... protected slots: void ButtonClicked(); // mainwindow.cpp void MainWindow::ButtonClicked() { QMessageBox msgBox; msgBox.setText("Clicked"); msgBox.exec(); }
It works, but I wonder whether this is correct way to do this. Is slot declaration and implementation supposed to be added manually, or I am missing something?