Well, here's how things are going for me so far: I managed to embed cefsimple's window inside my Qt application, but I hit
QTBUG-40320 -- specifically, Part 2, "Quirks with initial geometry". I managed to come up with a workaround:
- Code: Select all
QTimer::singleShot(1, [this]()
{
auto mainWindow = qobject_cast<QWidget *>(parent());
auto size = mainWindow->size();
mainWindow->resize(size + QSize(1, 1));
mainWindow->resize(size - QSize(1, 1));
});
Rather ugly, but it does the job.
My other problem, though, is that I have to create a cefsimple window,
then embed it into my Qt Window, making the window briefly flash before it's embedded. This is a kinda serious regression from before, since, by setting the id with SetAsChild, the cefsimple window is created inside its parent right away. Here's my step-to-step:
- Create the window with CefBrowserHost::CreateBrowser (or CreateBrowserSync)
- Get the window handle at CefLifeSpanHandler::OnAfterCreated (or from the CefBrowser returned by CreateBrowserSync)
- Send the window handle to the qt application
- Get the window using QWindow::fromWinId and embed it using QWidget::createWindowContainer
- Do the aforementioned workaround
Any possible steps to put between the ones above to prevent the flashing window? It doesn't happen all the time, but it's kinda disruptive when it does.
Thanks again.
EDIT: A late update about this to anyone who might find this thread on Google. From the QTBUG mentioned above:
(Win) The embedded window stops receiving key press and mouse wheel events (although mouse click events are still fine).
So, yeah. You can find a way to work around the issues described in that bug on Linux, but this specific problem makes this embedding approach impractical on Windows -- and there's definitely
NO way around this, from what I've talked to Qt devs. So, Windows users should stick to CefWindowInfo::SetAsChild(), which still works (even with CEF 2623).
Good luck!