SqlQueryWidget: some fixes, styling, refactoring.
QueryThread: refactoring, fixes.