I'm developing some Qt project.
I have the common Qt application (exe). and it attaches plugin - Qt library (dll).
Both are GUI.
So i have to create QApplication instances both in exe and dll.

Because there must be only one QApplication object, I've tried to create second instance in QThread.
But when I create second instance of QApplication in dll, this causes error
Qt Code:
  1. ASSERT failure in QCoreApplication: "there should be only one application object"
To copy to clipboard, switch view to plain text mode 

So i tried to check if qApp exists and create instance of QApplication only if it's null.
So then i have error
Qt Code:
  1. ASSERT failure in QWidget: "Widgets must be created in the GUI thread."
To copy to clipboard, switch view to plain text mode 

Does anybody know how to solve this problem?