QMainWindow se cierra justo después de show ()
Soy nuevo en Qt (uso principalmente Objective-C), así que estoy atrapado con un problema probablemente novato. Desde elQDialog
ventana trato de abrirQMainWindow
Me gusta esto:
this->close();
SQLWindow window;
window.receivePath(path); //Path for the .sqlite file
window.show()
QDialog
cierra y por milisegundos veo una nueva ventana, pero también se cierra. A continuación esQMainWindow
parte:
SQLWindow::SQLWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::SQLWindow)
{
ui->setupUi(this);
this->initialSetup();
}
SQLWindow::~SQLWindow()
{
delete ui;
}
void SQLWindow::initialSetup()
{
ui->tableView->setSortingEnabled(true);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
void SQLWindow::receivePath(QString path)
{
this->openDatabase(path);
}
void SQLWindow::openDatabase(QString path)
{
//Opening database just fine
}