void qt5_early_prepare(bool isOnscreen)
{
- Q_INIT_RESOURCE(resource);
- qInstallMessageHandler(qMessageOutput);
qt5IsOnscreen = isOnscreen;
-#ifdef CONFIG_DARWIN
-#define LIBQCOCOA "libqcocoa.dylib"
- /* load libqcocoa.dylib */
- QStringList libPaths = QCoreApplication::libraryPaths();
- qDebug() << "default Qt plugin library path : " << libPaths;
-
- int i = 0;
- for ( ; i < libPaths.count(); i++) {
- QFileInfo libFileInfo(libPaths.at(i) + QDir::separator() +
- "platforms" + QDir::separator() + LIBQCOCOA);
- if (libFileInfo.exists() == true) {
- break;
- }
- }
+ Q_INIT_RESOURCE(resource);
- if (i >= libPaths.count()) {
- qDebug() << LIBQCOCOA << " file not found. " <<
- "Qt plugin library path is converted to current path.";
- QCoreApplication::setLibraryPaths(QStringList(QDir::currentPath()));
- }
+#ifdef CONFIG_LINUX
+ /* QGLWidget threading: Note that under X11 it is necessary to set the
+ * Qt::AA_X11InitThreads application attribute to make the X11 library
+ * and GLX calls thread safe, otherwise the above scenarios will fail. */
+
+ /* Calls XInitThreads() as part of the QApplication construction in order
+ * to make Xlib calls thread-safe. This attribute must be set before
+ * QApplication is constructed. */
+ QCoreApplication::setAttribute(Qt::AA_X11InitThreads);
#endif
qt5App = new QApplication(argc, argv);
+
+ /* add the path in the application's main() function, right after the
+ * QApplication object is created */
+ qt5App->addLibraryPath(QDir::currentPath()); //TODO: consider a symbolic link
+
+ qInstallMessageHandler(qMessageOutput);
+
+ qDebug() << "* Qt plugin library path:" << QCoreApplication::libraryPaths();
}
void qt5_prepare(void)