It's may be too late but... better than not.

I found the problem is sqlite version i'm using is not match with the version Qt used in the core of Qt Framework.

So, I'm check the compatible of sqlite.h (3rd party) with Qt Sqlite driver to make sure it is the same version like this:

//Qt QSqlDatabase driver for Sqlite
query = db.PrepareQuery("SELECT sqlite_version()");

//Vs 3rd Party driver (included sqlite.h)
qDebug() << "sqlite3_libversion() =" << sqlite3_libversion();

there are few note to remember:

Cannot create SQLite custom functions when db object is not open. Need to call sqlite3_initialize() before call sqlite3_create_function()

If you have more questions, contact me via facebook Lã Đại Đồng. :)