Qt Application hangs on exit (after QDialog exec)

I'm using Qt to build a UI and I need to have a dialog window show up before the main app window, so that the user can select some files to load ans things like that. What I've got is a fairly simple main:

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    IView *view = new QtView();
    view->showView();
    int rc = a.exec();
    std::cout << "exit" << std::endl;
    return rc;
}

the QtView class is the concrete implementation of the IView interface. It has the mainwindow instance and a QDialog instance too. int the view->showView() method this is what I've got:

void QtView::showView()
{
    this->_configDialog->exec();
    this->_mainAppWindow->show();
}

It works fine, the dialog opens and when the user clicks OK, exec returns and the main window appears. The problem is that when I quit the main window I get a zombie process and the app just seems to hang even though all the windows have been closes and I never get the "exit" I print out in the main just before the main returns. I'm not sure what I'm doing wrong, but I get the same resutl even if I click on the cross to close the dialog, the main window opens up, and once closed the whole things just hangs there.

If anyone has any advice, that would be cool. Thanks.

Answers


I Fixed my problem. I used the accepted/rejected/finished(int) signal from the QDialog to trigger the show slot on the main app window, and display it if the dialog was accepted. Thanks for the help anyway.


Need Your Help

replace text only in clause determinated by keywork

sed

I want to processes text in some files that sometime expression exist in one line and sometime in multiple line

“Base table or view already exists” when creating a table with PDO

php pdo mysqli

I'm getting a fairly straightforward error when trying to CREATE TABLE with PDO. The same query below works fine when issued with standard mysqli functions.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.