资源简介
最近,C++和WEB本地混合应用开发模式逐渐流行起来,个人也认为标记语言描述的界面是界面开发的一个发展趋势。WPF、Java FX,当然也少不了Html。基于Html的界面在开发效率,可移植性上都十分有优势,所以也被很多程序采用
随着HTML5技术风生水起,Qt开发团队用近一年的时间开发了一个全新的基于Chromium的浏览器引擎Qt WebEngine,以支持面向未来的Hybrid应用开发,并完全支持桌面和嵌入式平台。
本例实现基于Qt WebChannel 的QT与HTML页面通信

代码片段和文件信息
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or alternatively in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1 included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include “document.h“
void Document::setSendTextText(const QString &text)
{
s_text = text;
emit sendText(s_text);
}
void Document::displayMessage(const QString &message)
{
mainUi->editor->appendPlainText(message);
}
/*!
This slot is invoked from the HTML client side and the text displayed on the server side.
*/
void Document::receiveText(const QString &r_text)
{
displayMessage(Qobject::tr(“Received message: %1“).arg(r_text));
}
void Document::setUi(Ui::MainWidget *ui)
{
mainUi = ui;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 139776 2016-01-12 03:24 webchanneltest\debug\webchanneltest.exe
文件 3182592 2016-01-12 03:24 webchanneltest\debug\webchanneltest.pdb
文件 2483 2016-01-12 09:13 webchanneltest\document.cpp
文件 2640 2016-01-12 09:12 webchanneltest\document.h
文件 421 2016-01-12 02:04 webchanneltest\htmlpage.cpp
文件 2164 2016-01-12 08:01 webchanneltest\index.html
文件 206 2016-01-12 03:13 webchanneltest\main.cpp
文件 891 2016-01-12 22:14 webchanneltest\mainwidget.cpp
文件 513 2016-01-12 09:01 webchanneltest\mainwidget.h
文件 2129 2016-01-12 07:58 webchanneltest\mainwidget.ui
文件 24491 2016-01-12 03:25 webchanneltest\Makefile
文件 78909 2016-01-12 03:25 webchanneltest\Makefile.Debug
文件 78942 2016-01-12 03:25 webchanneltest\Makefile.Release
文件 2377 2015-12-14 10:27 webchanneltest\previewpage.cpp
文件 2309 2015-12-14 10:27 webchanneltest\previewpage.h
文件 14837 2015-12-14 10:27 webchanneltest\qwebchannel.js
文件 3876 2016-01-12 09:13 webchanneltest\release\document.obj
文件 2207 2016-01-12 09:12 webchanneltest\release\main.obj
文件 94651 2016-01-12 22:29 webchanneltest\release\mainwidget.obj
文件 6106 2016-01-12 09:12 webchanneltest\release\moc_document.cpp
文件 7388 2016-01-12 09:12 webchanneltest\release\moc_document.obj
文件 3453 2016-01-12 09:12 webchanneltest\release\moc_mainwidget.cpp
文件 3432 2016-01-12 09:13 webchanneltest\release\moc_mainwidget.obj
文件 2743 2016-01-12 08:33 webchanneltest\release\moc_previewpage.cpp
文件 2777 2016-01-12 08:33 webchanneltest\release\moc_previewpage.obj
文件 3086 2016-01-12 08:33 webchanneltest\release\previewpage.obj
文件 33961 2016-01-12 08:33 webchanneltest\release\qrc_webchanneltest.cpp
文件 11627 2016-01-12 08:33 webchanneltest\release\qrc_webchanneltest.obj
文件 59392 2016-01-12 22:29 webchanneltest\release\webchanneltest.exe
文件 4578 2016-01-12 08:33 webchanneltest\ui_mainwidget.h
............此处省略9个文件信息
相关资源
- 微博系统(Java源码,servlet+jsp),适
- jsonarray所必需的6个jar包.rar
- JSP企业人事管理系统设计(源代码+论
- 当当网完整项目、包括js、css、html
- 实现一个图书管理系统
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- JSP,SQL,MVC的选课系统
- 基于JSP的学生宿舍管理系统(源码 数
- JSP选课管理系统
- mysql jsp网站源码下载
- JSP做的化妆品商城
- Jsp购物车实例
- 基于JSP的校友信息管理系统(添加数
- 基于jsp的bbs论坛 非常详细
- jsp oracle通讯录
- JSP学生信息管理系统 Mysql数据库
- 使用jsp servlet做的投票系统
- JSP登陆验证 实现JSP用户名 密码 验
- 通过java将word文档转换成html页面
- jsp基于servlet 图书馆管理系统
- jsp学生成绩管理系统.rar
- 在线考试系统源代码(jsp)
- 超级好的纯jsp写的聊天室
- JSP 网上购物网页项目
- JSP+mysql新闻发布系统.rar
- jsp 学生信息管理系统设计与实现
- jsp与SQL Server数据库实现的客户注册登
- 简易教学管理系统(jsp spring struts h
- 学生信息管理系统 JSP MySQL
评论
共有 条评论