====== HelloWorld ====== ===== Root widget on the stack ===== // main.cpp #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); // create a QApplication (on the stack) QLabel label("Nice to meet you."); // root widget (on the stack) label.show(); // show it return a.exec(); // start the event loop } ===== Root widget on the heap ===== // main.cpp #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); // create a QApplication (on the stack) QLabel* label = new QLabel("I'm on the heap!"); label->show(); return a.exec(); // start the event loop }