CEF(chromium embedded framework) and QT cross-platform integration

  • Hi,

    I'm new on this forum and before posting I've searched the forum for an answer to my questions and found nothing.


    I have to integrate CEF(chromium embedded framework) with an existing Qt based cross-platform (Mac and Windows) application. Due to legacy web code, third party web applications integration and automatic proxy authentication I cannot use QtWebKit for this task,

    What have I tried:

    1. To use CEF with multi-threaded-message-loop. While this works on Windows it doesn't work on Mac. Cocoa doesn't allow to have multiple UI threads and all UI related work should be done on the main thread. CEF with multi-threaded-message-loop creates a separate window events handler thread, who manages windows created by CEF.

    2. Custom loop in this way:

            a.processEvents(); //is the same function that is called from the default .exec() application loop

    But here I saw several issues. Both CEF and Qt on Windows have the following default loop implementation:

    • PeekMessage with PM_REMOVE, removes the message from the queue

    • TranslateMessage

    • DispatchMessage

    In addition, QT's windows events dispatcher adds the following specific message handling:


     haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
                    if (haveMessage && (flags & QEventLoop::ExcludeUserInputEvents)
                        && ((msg.message >= WM_KEYFIRST
                             && msg.message <= WM_KEYLAST)
                            || (msg.message >= WM_MOUSEFIRST
                                && msg.message <= WM_MOUSELAST)
                            || msg.message == WM_MOUSEWHEEL
                            || msg.message == WM_MOUSEHWHEEL
                            || msg.message == WM_TOUCH
    #ifndef QT_NO_GESTURES
                            || msg.message == WM_GESTURE
                            || msg.message == WM_GESTURENOTIFY
                            || msg.message == WM_CLOSE)) {


                   else if (msg.message == WM_TIMER) {
                        // avoid live-lock by keeping track of the timers we've already sent
                        bool found = false;
                        for (int i = 0; !found && i < processedTimers.count(); ++i) {
                            const MSG processed = processedTimers.constData()[i];
                            found = (processed.wParam == msg.wParam && processed.hwnd == msg.hwnd && processed.lParam == msg.lParam);
                        if (found)
                    } else if (msg.message == WM_QUIT) {
                        if (QCoreApplication::instance())
                        return false;

    If the messages that have special treatment in Qt's windows event dispatcher are dispatched by the CEF's loop, the application looses functionality. I don't know all the QT features that are used by the application to know the effects of removing some of the QT functionality.

    For Mac I've seen that there are Carbon/Cocoa event dispatchers and I don't have the experience to understand if CEF message loop goes hand in hand with Qt's.

    1. Separate CEF process controlled through IPC. The CEF process was supposed to create browser child windows and attach them to the main process windows. On Windows this works because you can attach child windows to another process' windows, but on Mac I was unable to do that using the documented Cocoa APIs.

    I need to know if there is a successful story of integrating CEF with Qt, without source code modification in any of them and without using CEF with window less rendering.

    Any help is appreciated! ;)

    Thank you,

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.