MainWindow from code from the main.cpp in Qt
Want to understand the difference in code between the MainWindow and the main.cpp . Specifically, how a chunk of code written exclusively in the main.cpp needs to be modified to be part of the mainwindow.cpp and mainwindow.h . As an example, I am trying to modify the code from this fine answer to work in MainWindow . main.cpp #include <QtWidgets> #include <QtNetwork> int main(int argc, char *argv[]) { QApplication a(argc, argv); //setup GUI (you could be doing this in the designer) QWidget widget; QFormLayout layout(&widget); QLineEdit lineEditName; QLineEdit lineEditGender; QLineEdit