I am new to Qt (use Objective-C mostly) so I am stuck with probably noob issue. From the QDialog
window I try to open QMainWindow
like this:
this->close();
SQLWindow window;
window.receivePath(path); //Path for the .sqlite file
window.show()
QDialog
closes and for millisecond I see a glimpse of a new window, but it closes too. Below is QMainWindow
part:
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
}