dorafather |
2020-11-19 13:45 |
QT+CEF完美实现WEB与C++的混合编程
1、采用QT编写的CEFVIEW作为主窗口,采用谷歌内核 2、当客户需要CS架构时(比如大量视频监控时),可嵌入之前BS的漂亮UI,加上自己的视频监控组成新的CS 3、关键代码如下: if(m_isInitClient) return; m_isInitClient = true; m_cefClient = cefClient;
m_cefTimer = new QTimer(this); connect(m_cefTimer, SIGNAL(timeout()), this, SLOT(onCefTimer())); m_cefTimer->start(10);
QCefClient* cefClientPtr = m_cefClient.get(); connect(cefClientPtr, SIGNAL(loadStarted(bool)), this, SIGNAL(loadStarted(bool))); connect(cefClientPtr, SIGNAL(loadFinished(bool, bool)), this, SIGNAL(loadFinished(bool, bool))); connect(cefClientPtr, SIGNAL(loadError(QString)), this, SIGNAL(loadError(QString))); connect(cefClientPtr, SIGNAL(webMsgReceived(QString)), this, SIGNAL(webMsgReceived(QString))); connect(cefClientPtr, SIGNAL(inspectorRequested()), this, SIGNAL(inspectorRequested()));
connect(cefClientPtr, SIGNAL(processQueryRequest(const QCefQuery&)), this, SLOT(onQCefQueryRequest(const QCefQuery&))); connect(cefClientPtr, SIGNAL(invokeMethodNotify(int, int, const QString, const QVariantList)), this, SLOT(onInvokeMethodNotify(int, int, const QString, const QVariantList)));
|
|