ui: modified qt5_early_prepare
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 7 Jul 2015 11:17:52 +0000 (20:17 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 8 Jul 2015 07:22:43 +0000 (16:22 +0900)
add AA_X11InitThreads attribute
call a qInstallMessageHandler after QApplication object is created
use addLibraryPath instead of setLibraryPaths

Change-Id: Ia63cfdf35a141295657fa235c443b0662752465c
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/display/qt5_supplement.cpp
tizen/src/ui/controller/dockingconview.cpp
tizen/src/ui/layout/hardwarekey.cpp

index a097e127ae0146f5b13cbec0189edb1171023744..05cb1cb2b70376fa4feadfbb0249b02261fbf97c 100644 (file)
@@ -277,33 +277,30 @@ void qt5_destroy()
 
 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)
index 9c2bebec5982535b491191a550619be1de7525d6..23ff6c7ca1d39eccb4d8b354015d93a3771b1831 100644 (file)
@@ -72,7 +72,7 @@ void DockingConView::createItems(ControllerForm *conForm)
             }
         }
     } else {
-        GeneralPurposeCon *generalCon = new GeneralPurposeCon(this, keyList,
+        GeneralPurposeCon *generalCon = new GeneralPurposeCon(parentWidget(), keyList,
             QSize(conForm->centerRect.width(),
                 conForm->centerRect.height() - GPC_HEAD_SPACING));
 
index e525d3622f27f4eaeb3a2d78ee03a6b19993d82c..ba09e5081b8016593b766344fb199d3aba44e4bc 100644 (file)
@@ -40,5 +40,5 @@ HardwareKey::HardwareKey(QString name, int keycode, QRect region, QString toolti
 
 HardwareKey::~HardwareKey()
 {
-    qDebug("destroy HW key");
+    /* do nothing */
 }