It closes, because QDialog::show()
method is asynchronous and your catalog
object is destroyed right after your code leaves DiagramWindow::showCatalog()
method. You should rewrite it like this:
void DiagramWindow::showCatalog()
{
catalog *c = new catalog(this);
c->setAttribute(Qt::WA_DeleteOnClose);
c->show();
}