fixed qsqldatabase disconnection bug after exiting preferences