Code Monkey home page Code Monkey logo

qcefwidget's Introduction

>>> 中文版

1. QCefWidget

The QCefWidget project provide a widget that used to render and interact with webpage.

Support:

✅ Supports both CEF OSR and non-OSR mode;

✅ Show background transparent webpage in irregularity window;

✅ Javascript and Qt interaction;

✅ OpenGL graphics acceleration;

✅ Third-party input method software;

✅ Perfect exit app without any CEF assert/exception in debug/release mode;

✅ Separate CEF rendering process and plugin process;

✅ Support Adobe Flash without any warnning, eg "Control-click to run Adobe Flash Player".

✅ Drag/Drop frameless window like Electron throught setting CSS property.

✅ Move between mixed scale factor monitors.


2. Build Instruction

2.1 CMake

Download and install CMake.

2.2 Qt SDK

Download and install Qt SDK from Qt Downloads.

2.3 CEF binary distribution.

Download CEF binary distribution from Chromium Embedded Framework (CEF) Automated Builds and extract it to dep (Optional) directory.

For example:

root
├─dep
│  └─cef_binary_80.1.15+g7b802c9+chromium-80.0.3987.163_windows32
├─src
└─test

2.4 config.cmake

Update the config.cmake to set the required build configurations.

2.4.1 QCefWidget SDK Version

SET(QCEF_VERSION_MAJOR 1)
SET(QCEF_VERSION_MINOR 0)
SET(QCEF_VERSION_PATCH 3)

2.4.2 CEF SDK

Special CEF SDK folder:

set(CEF_SDK_DIR  "${CMAKE_CURRENT_SOURCE_DIR}/dep/cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows32")

Special CEF SDK version:

SET(CEF_VERSION_MAJOR 76)
SET(CEF_VERSION_MINOR 1)
SET(CEF_VERSION_PATCH 13)

CEF has two version format:

  • 3.3683.1920.g9f41a27 / Chromium 73.0.3683.75
  • 73.1.3+g46cf800+chromium-73.0.3683.75 / Chromium 73.0.3683.75

For CEF_VERSION_XXX macro, the first format type borrows the first 3 paragraphs of the Chromium's version number, the second format can use CEF's version directly.

QCefWidget library will use these version macro to support different CEF version, such as:

#if CEF_VERSION_MAJOR == 72
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
			CefProcessId source_process,
			CefRefPtr<CefProcessMessage> message) override;
#elif CEF_VERSION_MAJOR == 76 || CEF_VERSION_MAJOR == 89
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
			CefRefPtr<CefFrame> frame,
			CefProcessId source_process,
			CefRefPtr<CefProcessMessage> message) override;
#endif

2.5 Using CMake to build the project.

For example:

mkdir build && cd build
cmake .. && cmake --build .

3. Test

QCefWidget has been tested with follow Qt and CEF version:

Qt Version CEF Version Pass
5.12.10 3.3626.1895
5.12.10 76.1.13
5.12.10 89.0.18
5.14.2 3.3626.1895
5.15.2 74.1.19
5.15.2 76.1.13
5.15.2 89.0.18
5.15.2 91.1.2

In theory, other Qt5+ versions and CEF versions are also supported.

4. Usage

QCefWidgetTest is a perfect demo about how to use QCefWidget in test folder.

screenshot1 on windows

screenshot2 on windows

5. Donate

Open source is not a easy work, please support me! If you don't want to donate, just Star⭐ it.

6. Code structure

The following figure shows about how to destroy the QCefWidget and window when user clicked the X button (or sends a WM_CLOSE message to the window):

user clieck x button

When the window closed by QWidget::close(), the process of QCefWidget and window destruction is slightly different from the above picture, but it is roughly similar.

qcefwidget's People

Contributors

winsoft666 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.