0

I'd like to show a widget as a new process and run parallel in my Qt application (Windows). Like Chrom, that create a process for each tab.

I know in Linux we can use fork to create a new process and the child can continue like as the parent. But my application work in Windows. I used QThread to create and show a widget, but this error occurred:

ASSERT failure in QWidget: "Widgets must be created in the GUI thread.", file kernel\qwidget.cpp, line 1144
MHZarei
  • 133
  • 1
  • 7
  • 2
    You can't do that with Qt. If you want to have actually separate processes for each of the tabs in your application, you'll have to come up with some IPC mechanism for communication between separate processes, since there is always only one GUI thread per one Qt application. – Daniel Kamil Kozar Jul 10 '18 at 18:53
  • Qt does it but for the Chromium-based browser to which you can insert some code of yours. See: https://wiki.qt.io/QtWebEngine. But that will be a customized web-browser project. – Alexander V Jul 10 '18 at 18:57
  • 2
    There's nothing to stop you forking a new process with [`QProcess`](http://doc.qt.io/qt-5/qprocess.html) that creates one or more `QWidget`s. You could then \`capture' those widgets using [`QWidget::createWindowContainer`](http://doc.qt.io/qt-5/qwidget.html#createWindowContainer) provided you can determine their handles. This does sound a bit XY though. What's the real problem you're trying to solve. – G.M. Jul 10 '18 at 19:20
  • Thanks @DanielKamilKozar, I'm trying to run my application with QProcess, and show my desired widget in main function. – MHZarei Jul 10 '18 at 19:22
  • If the problem is an entry in task bar then not even new process required: https://stackoverflow.com/questions/39792351/qt-force-child-window-to-have-its-own-task-bar-entry – Alexander V Jul 10 '18 at 22:38

0 Answers0