View on GitHub

Qcefview

QT, CEF, Integration

Download this project as a .zip file Download this project as a tar.gz file

QCefView - A Qt widget integrated with CEF

QCefView is a Qt widget integrated with Chrome Embedded Framework. You can use QCefView without writing any code relating to CEF code. This Qt widget is distributed in binary module and LGPL licensed.

Why use QCefView

There are some UI frameworks developed with CEF, such as Electron and others. But Electron is over-encapsulated with CEF, you can only develop your application with it by writing javascript code. If you need to use native code in your application while CEF is also needed, Electron is not the good choice in this situation. You can do the integration by youself totally, of cause you need to do much work about communication between web code and native code. And most time this is repetitive work.

Now you can try to use QCefView to develop your application. Just use it like any other QWidgets. QCefView widget provides several methods to do communication between native C++ code and web javascript code. You don’t need to write the communicating business logical.


Build instruction:

  1. Download and install CMake
  2. Download and install Qt SDK from Qt Downloads
  3. Download CEF binary distribution Chromium Embedded Framework (CEF) Automated Builds and extract it to dep directory, for example:
     root
     ├─dep
     │  └─cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows64
     ├─src
     └─test
    
  4. Modify the config.cmake to set the required build configurations
  5. Just use CMake to build the project, for example:
     REM create the build folder 
     mkdir build.win && cd build.win
    
     REM generate and build the project
     cmake .. && cmake --build .
    

Note: When I start the reforming I use Qt 5.12.4 and CEF cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows64. You need to make sure the version you are choosing is compatible with the code in this repo.

  1. Collect all build artifacts in outpu folder


Document

Please refer to the soruce code.

Qt Side

Web Side:


QCefClient Object


QCef Query


QCef Url Request