Why does a lazy-loaded QWidget get displayed but a stored one does not? <p>I have a collection of small popup widgets that appear in various places, but only one of each and one at a time. For simple functionality, new-to-show and delete-to-hide is okay and works like it's supposed to, but as they start to handle their own data, I can see a memory leak coming up.</p> <p>So because I only need one of each kind, I thought I'd create all of them up front in the parent constructor and just show and hide them as needed. As far as I can tell, that ought to work, but popup->show() doesn't show. The complex app that this example is based on shows that the popup does exist at the correct location and can interact with the user...except that it's invisible.</p> <p>Here's the lazy version that shows:</p> <pre><code>#ifndef MAIN_H #define MAIN_H #include &lt;QtWidgets&gt; class Popup : public QLabel { Q_OBJECT public: explicit Popup(int x, int y, int width, int height, QWidget* parent = 0); }; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget* parent = 0); ~MainWindow() {} void mousePressEvent(QMouseEvent* ev); private: Popup* popup; }; #endif // MAIN_H /*************** *** main.cpp *** ***************/ #include "main.h" #include &lt;QApplication&gt; int main(int argc, char* argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { popup = 0; QWidget* cWidget = new QWidget(this); cWidget-&gt;setStyleSheet("background-color: lightgray"); setCentralWidget(cWidget); showMaximized(); } void MainWindow::mousePressEvent(QMouseEvent* ev) { if(popup != 0) { if(!popup-&gt;geometry().contains(ev-&gt;x(), ev-&gt;y())) { delete popup; popup = 0; } } else { popup = new Popup(ev-&gt;x(), ev-&gt;y(), 100, 100, this); popup-&gt;show(); } ev-&gt;accept(); } Popup::Popup(int x, int y, int width, int height, QWidget* parent) : QLabel(parent) { setStyleSheet("background-color: black"); setGeometry( x - (width / 2), // Left y - (height / 2), // Top width , // Width height // Height ); } </code></pre> <p>And here's the pre-created version that doesn't show:</p> <pre><code>#ifndef MAIN_H #define MAIN_H #include &lt;QtWidgets&gt; class Popup : public QLabel { Q_OBJECT public: explicit Popup(QWidget* parent = 0); void setup(int x, int y, int width, int height); }; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget* parent = 0); ~MainWindow() {} void mousePressEvent(QMouseEvent* ev); private: Popup* popup; }; #endif // MAIN_H /*************** *** main.cpp *** ***************/ #include "main.h" #include &lt;QApplication&gt; int main(int argc, char* argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { popup = new Popup(this); QWidget* cWidget = new QWidget(this); cWidget-&gt;setStyleSheet("background-color: lightgray"); setCentralWidget(cWidget); showMaximized(); } void MainWindow::mousePressEvent(QMouseEvent* ev) { if(popup-&gt;isVisible()) { if(!popup-&gt;geometry().contains(ev-&gt;x(), ev-&gt;y())) { popup-&gt;hide(); } } else { popup-&gt;setup(ev-&gt;x(), ev-&gt;y(), 100, 100); popup-&gt;show(); } ev-&gt;accept(); } Popup::Popup(QWidget* parent) : QLabel(parent) { setStyleSheet("background-color: black"); } void Popup::setup(int x, int y, int width, int height) { setGeometry( x - (width / 2), // Left y - (height / 2), // Top width , // Width height // Height ); } </code></pre> <p>What am I missing?</p>