0

I am currently on Qt5, and want to emulate Qt4's X11EmbedWidget, which has been removed. All sources I can find online point me to using QWindow::fromWinId to make the native window into a QT window, then using QWidget::createWindowContainer() to put the window into another.

I am creating the child process using fork and execve, like so

pid_t pid = fork();

if (pid == 0) {
  //child
  execv("./application.bin", NULL);
  exit(0);
} else {
  //parent

  //get window ID
  //use createWindowContainer
}

i just can't seem to get the window ID with this. I found this post, but it gives an empty list every time. Is there any way to do this directly from execv() or fork()?

Ulrich Eckhardt
  • 16,572
  • 3
  • 28
  • 55
Ank i zle
  • 2,089
  • 3
  • 14
  • 36
  • 1
    fork will not create a window so how should fork return such an id? You have to pass it to the calling application somehow (e.g. through stdout) – chehrlic Mar 06 '22 at 08:48

1 Answers1

0

I realized my error. The reason the window ID outputted from this answer always gives 0 is because I was trying to fetch the ID right after the execv(). I added in a usleep(3e4) before trying to get the window ID and it worked well.

Ank i zle
  • 2,089
  • 3
  • 14
  • 36