Important: Please read the Qt Code of Conduct -

How to drag and drop into QOpenGLWindow?

  • In the MainForm of my application, I implemented both dragEnterEvent() and dropEvent(). MainForm contains a splitter and I want to have one of the splitter panels to display contents of QOpenGLWindow. I also want to support some QWidget-like functionality associated with this panel. There are reasons why I don't want to use QOpenGLWidget so I used QWidget::createWindowContainer() to house my window. Now I struggle to make drag and drop work. It works if a drop happens above other areas of the main form but not above QOpenGLWindow. Event handling functions simply never get called. While investigating I implemented eventFilter and installed it for both QWindowContainer and MainForm. I do see that both events do come to QWindowContainer but they never propagate to the main form. (I would expect that to be the default behavior without any work on my part). My attempts to use brutal force and direct these events to MainForm result in ugly hacks that either has to deal with recursion inside of eventFilter (using send/post) or make MainForm drag and drop handlers public.

    Is there a better way to deal with this issue?

Log in to reply