I have the problem thats my programm Gui was closed.
For example I put this code in a pushButtonClicked
method:
database->addDatabase("QMYSQL", "conn1");
database->setHostName("127.0.0.1");
database->setPort(3306);
database->setDatabaseName( "mydb" );
database->setUserName("root");
database->setPassword("XXXX");
if ( !database->open() )
{
qDebug("Couldn't open DB");
}
It views my Gui, but when I click the button, it closes the window.
When I put this code in an init-method, it doesn't view a window.
What's wrong on this code?
The database is a QSqlDatabase. I declare it in my header.
When I delete this code, everything works normally.