QtCef
A Cef Qt port , inject C++ API to Cef js context using reflection based on Qt's meta object system
Install / Use
/learn @hiitiger/QtCefREADME
QtCef
Integrate CEF and Qt, inject C++ API to CEF web page by utilizing reflection system based on Qt's MOC.
Note
- this is for Qt5, checkout qt4archive branch for Qt4
- need VS2015 or later
Build
- download CEF 3.3538 to deps direcotry and unzip to dir cef3538
- build cef libcef_dll_wrapper with VS2015
- copy cef.lib and libcef_dll_wrapper.lib to common/lib/debug or common/lib/release, copy cef release dlls and resources to bin/debug or bin/release
- generator VS2015 solution with qmake -tp vc -r
- build all
Usage
With Qt's MOC based reflection, we can utilize it to inject C++ api into Cef web page without manually add every signle method and event for every single api.
//main process
QCefOSWidget* webWidget = new QCefOSWidget();
MyAppApi* api = new MyAppApi(parent);
QCefApiAdapter* adapter = new QCefApiAdapter(webWidget, parent);
adpater->initApi(api, "myapp", "app");
MyToolApi* toolApi = new MyToolApi(parent);
QCefApiAdapter* toolApiAdapter = new QCefApiAdapter(webWidget, parent);
toolApiAdapter->initApi(toolApi, adapter->apiPath(), "tool");
//we are good to go
//webpage
a = {"a": 123};
myapp.app.apiFunc(a, data => console.log(data));
myapp.app.apiAsyncFunc(a).then( data => console.log(data));
myapp.app.someEvent.addListener( data => console.log(data));
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
