QObject *QFactoryLoader::instance(int index) const { Q_D(const QFactoryLoader); QVector staticPlugins = QLibraryPrivate::staticPlugins(); /* determine whether index is referring to a shared plugin or a static one */ if (index >= 0 && index < d->libraryList.size()) { /* shared plugin */ QLibraryPrivate *library = d->libraryList.at(index); if (library->instance || library->loadPlugin()) { if (!library->inst) library->inst = library->instance(); QObject *obj = library->inst.data(); if (obj) { if (!obj->parent()) obj->moveToThread(QCoreApplicationPrivate::mainThread()); return obj; } } return 0; } else if(index>=d->libraryList.size() && (index-d->libraryList.size())libraryList.size()).instance(); } else { return 0; } }