@Lasith Sure many ways... easiest is probably just a plain text file, but you could use JSON, xml, whatever.
Keep in mind unless you encrypt it the details would be insecure and easily viewed. If it's just for development no big deal though.
Some example code:
QFile f("myconfigfile");
if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
return; // fail
QTextStream fs(&f);
// assumes 1 field per line and minimum of 4 fields
QString host = fs.readLine();
QString database = fs.readLine();
QString user = fs.readLine();
QString pass = fs.readLine();
Edit: your myconfigfile would look like this:
myhost
mydb
myuser
mypass