/src/os/qt/ftk_qt.cpp

http://ftk.googlecode.com/ · C++ · 35 lines · 27 code · 8 blank · 0 comment · 0 complexity · a5f668857d96b1467a4e1edfecd85986 MD5 · raw file

  1. extern "C" {
  2. #include "ftk_typedef.h"
  3. }
  4. #include "ftk_display_qt.h"
  5. #include <QtGui/QApplication>
  6. #include <QtGui/QWidget>
  7. extern "C" int FTK_MAIN(int argc, char* argv[]);
  8. static pthread_t thread;
  9. static void* thread_func(void* data)
  10. {
  11. int argc = 1;
  12. char* argv[] = { (char*)"ftk" };
  13. FTK_MAIN(argc, argv);
  14. QApplication::exit(0);
  15. return NULL;
  16. }
  17. int main(int argc, char* argv[])
  18. {
  19. int rc;
  20. QApplication app(argc, argv);
  21. QWidget* widget = (QWidget*)ftk_display_qt_create_win();
  22. widget->show();
  23. pthread_create(&thread, NULL, thread_func, NULL);
  24. rc = app.exec();
  25. pthread_join(thread, NULL);
  26. return rc;
  27. }