Hi All,
I'm trying to embed an SDL_Window (SDL2) into a QT Application, my code snippet for doing it is the following:
auto window = QWindow::fromWinId((WId)Application::windowHandle());
window->resize(width, height);
SIEGE_ASSERT(window);
mRenderSurface
= QWidget::createWindowContainer(window
);
setCentralWidget(mRenderSurface);
auto window = QWindow::fromWinId((WId)Application::windowHandle());
window->resize(width, height);
SIEGE_ASSERT(window);
mRenderSurface = QWidget::createWindowContainer(window);
setCentralWidget(mRenderSurface);
To copy to clipboard, switch view to plain text mode
Application::windowHandle() returns the correct window id, the above results in the following:
http://i.imgur.com/xnEXGtO.png
For some reason the window isn't be "implanted" correctly into the central widget of the QMainWindow. If I use the GUI to resize the window, the widget will snap to the correct place, everything becomes resizeable and everything starts to work correctly. Am I missing a step in the process here that automatically implants and resizes it? From what I can tell when I add the widget to the central widget, it doesn't seem to repaint anything. It is also NOT an option to use the SDL_CreateWindowFrom function without patching SDL itself, this functionality is supposed to be on its way.
Thanks, Brkopac
edit: Currently using Qt 5.3
Bookmarks