Q:

Can I use Qt thread ID to create unique cache for every thread? 

I want to cache lazy loaded objects that are not thread safe.  Every thread should have it's own group of objects. 
My idea is to create QMap<int, MyObject> and access this map by thread ID that I get using QThread::currentThreadId().  The map itself would be protected by read/write mutex (that is, unique lock for writing, shared lock for reading).  It will not be acessed often. 
I am not sure if it's really a good idea.  Are there any problems with this approach? 

A:

From the official documentation (http://doc.qt.io/qt-4.8/qthread.html#currentThreadId)

Warning: The handle returned by this function is used for internal purposes and should not be used in any application code. 

Looks like this function is not meant to be used as a public function, so it's probably not a good idea to use it in your application in any way
Have you considered either using std::this_thread::get_id() or using a thread_local static object? 

A:

Try http://doc.qt.io/qt-5/qthreadstorage.html. 
Examplecode:
QThreadStorage<QCache<QString, SomeClass> > caches;

void cacheObject(const QString &key, SomeClass *object)
{
    caches.localData().insert(key, object);
}

void removeFromCache(const QString &key)
{
    if (! caches.hasLocalData())
        return;

    caches.localData().remove(key);
}

