Giter Club home page Giter Club logo

qtcef's Introduction

QtCef

Codacy Badge

Integrate CEF and Qt, inject C++ API to CEF web page by utilizing reflection system based on Qt's MOC.

Note

  1. this is for Qt5, checkout qt4archive branch for Qt4
  2. need VS2015 or later

Build

  1. download CEF 3.3538 to deps direcotry and unzip to dir cef3538
  2. build cef libcef_dll_wrapper with VS2015
  3. 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
  4. generator VS2015 solution with qmake -tp vc -r
  5. 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));

qtcef's People

Contributors

codacy-badger avatar hiitiger avatar

Watchers

 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.