Problem solved! I have modified the code, now it looks like this:
#include <QSqlRecord>
#include <QSqlError>
QStringList liblist;
liblist.push_back("c:/Qt/4.8.0/plugins/");
liblist.push_back("c:/Qt/4.8.0/bin/");
QCoreApplication::setLibraryPaths(liblist);
QLibrary mysqllib("qsqlmysqld4.dll");
mysqllib.load();
auto t1 = mysqllib.isLoaded();
qDebug()<<"my library loaded"<<mysqllib.isLoaded();
QPluginLoader plug("qsqlmysqld4.dll");
plug.load();
auto t2 = plug.isLoaded();
qDebug()<<"mysql plugin is loaded"<<plug.isLoaded();
ui->textEditContent->append( "--SQL DRIVERS SUPPORTED:--\n" );
FOREACH( auto driver, QSqlDatabase::drivers() )
ui->textEditContent->append( " " + driver + "\n" );
It seems that even if Qt have paths to it's own folder you need to specify them before loading the drivers. You can do this by adding those lines:
QStringList liblist;
liblist.push_back("c:/Qt/4.8.0/plugins/");
liblist.push_back("c:/Qt/4.8.0/bin/");
QCoreApplication::setLibraryPaths(liblist);
If you want to include those drivers into your application folder as I do you create folder 'sqldrivers' in root of your application and add path to this root. So we have libmysql.dll and qsqlmysql.dll in:
X:\APPLICATION\sqldrivers\
and code looks like this:
QStringList liblist;
liblist.push_back(QDir::currentPath()); // Qt always looks for those drivers in <LIB_FOLDER_SPECIFIED>/sqldrivers/
//liblist.push_back("e:/Qt/4.8.0/bin/");
//liblist.push_back("e:/Qt/4.8.0/plugins/");
QCoreApplication::setLibraryPaths(liblist);