// main.cpp #include <QApplication> #include <QLabel> 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 }
// main.cpp #include <QApplication> #include <QLabel> 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 }