当前位置: 首页 > news >正文

asp.net动态网站模板下载软文发布平台排名

asp.net动态网站模板下载,软文发布平台排名,网站开发费用计入科目,网络工程毕业论文本篇简介 本篇的小目标: 借助Qt自家的QWebEngineView实现浏览器的基本功能:输入地址访问页面和刷新页面定制QWebEngineView的ContextMenu,实现Inspector调试界面的调用 QWebEngineView基础 首先在所创建项目的.pro配置中添加webenginewid…

本篇简介

本篇的小目标:

  • 借助Qt自家的QWebEngineView实现浏览器的基本功能:输入地址访问页面和刷新页面
  • 定制QWebEngineView的ContextMenu,实现Inspector调试界面的调用

QWebEngineView基础

首先在所创建项目的.pro配置中添加webenginewidgets模块:

QT += webenginewidgets

然后在主窗口初始化时创建QWebEngineView对象:

1 m_webView = new QWebEngineView(this);
2 QStackedLayout* layout = new QStackedLayout(ui->frame);
3 ui->frame->setLayout(layout);
4 layout->addWidget(m_webView);

界面上有一个输入地址的控件(adressEdit)和两个按钮——访问按钮(btnGo)和刷新按钮(btnRefresh),使用QWebEngineView的load和reload方法,可以很方便地实现这两个按钮的功能:

本文福利,费领取Qt开发学习资料包、技术视频,内容包括(C++语言基础,Qt编程入门,QT信号与槽机制,QT界面开发-图像绘制,QT网络,QT数据库编程,QT项目实战,QT嵌入式开发,Quick模块,面试题等等)↓↓↓↓↓↓见下面↓↓文章底部点击费领取↓↓

 1 connect(ui->btnGo, &QPushButton::clicked, this, [this]() {2     QString url = ui->addressEdit->text();3     if (!url.isEmpty())4     {5         m_webView->load(url);6     }7 });8 connect(ui->btnRefresh, &QPushButton::clicked, this, [this]() {9     m_webView->reload();
10 });

这样一个简单的浏览器就实现好了,访问一下百度看看效果:

 

实现Inspector调试界面

在谷歌浏览器中按一下F12可以调出功能强大的调试界面,QWebEngine中也包含了这个功能。这里我们稍微简化一下,改成在页面上点击右键并选择"Inspect",即可呼出调试界面。

首先需要设置一个环境变量QTWEBENGINE_REMOTE_DEBUGGING来指定调试页面所使用的端口号。例如,将7777端口设为调试端口,可在主窗口初始化方法的最开头添加下面的代码:

qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "7777");

如果设置成功,在终端上会打印如下提示:

Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:7777

然后实现一个QDialog作为Inspector的界面,里面内嵌另一个QWebEngineView,这个view专门用来加载调试页面:

 1 Inspector::Inspector(QWidget *parent) :2     QDialog(parent),3     ui(new Ui::Inspector)4 {5     ui->setupUi(this);6 7     connect(ui->btnClose, &QPushButton::clicked, this, [this](){8         hide();9     });
10 
11     m_webView = new QWebEngineView(this);
12     QStackedLayout* layout = new QStackedLayout(ui->frame);
13     ui->frame->setLayout(layout);
14     layout->addWidget(m_webView);
15     m_webView->load(QUrl("http://localhost:7777"));
16     QDialog::show();
17 }

因为这里的关闭按钮实际上只是把界面隐藏起来了,所以重载一下show方法,保证每次打开时调试的页面是最新的:

1 void Inspector::show()
2 {
3     m_webView->reload();
4     QDialog::show();
5 }

最后在主窗口初始化时修改一下QWebEngineViewContextMenu设置。因为QWebEngineView继承了QWidget,所以可以使用与处理QWidget类似的方式定制ContextMenu:

 1 m_webView->setContextMenuPolicy(Qt::CustomContextMenu);2 m_inspector = NULL;3 connect(m_webView, &QWidget::customContextMenuRequested, this, [this]() {4     QMenu* menu = new QMenu(this);5     QAction* action = menu->addAction("Inspect");6     connect(action, &QAction::triggered, this, [this](){7         if(m_inspector == NULL)8         {9             m_inspector = new Inspector(this);
10         }
11         else
12         {
13             m_inspector->show();
14         }
15     });
16     menu->exec(QCursor::pos());
17 });

这样一个简单的Inspector就实现完成了,试试效果:

本文福利,费领取Qt开发学习资料包、技术视频,内容包括(C++语言基础,Qt编程入门,QT信号与槽机制,QT界面开发-图像绘制,QT网络,QT数据库编程,QT项目实战,QT嵌入式开发,Quick模块,面试题等等)↓↓↓↓↓↓见下面↓↓文章底部点击费领取↓↓ 


文章转载自:
http://dinncopolymeter.zfyr.cn
http://dinncooleaginous.zfyr.cn
http://dinncosarcoma.zfyr.cn
http://dinncowarplane.zfyr.cn
http://dinncotassie.zfyr.cn
http://dinncoridgepole.zfyr.cn
http://dinncoagromania.zfyr.cn
http://dinncoredshank.zfyr.cn
http://dinncomycetozoan.zfyr.cn
http://dinncopaleographer.zfyr.cn
http://dinncocardiotoxic.zfyr.cn
http://dinncostutterer.zfyr.cn
http://dinncocameleer.zfyr.cn
http://dinncohematoxylic.zfyr.cn
http://dinncothicknet.zfyr.cn
http://dinncochapleted.zfyr.cn
http://dinncoperoxyacetyl.zfyr.cn
http://dinncofluvio.zfyr.cn
http://dinncoshipping.zfyr.cn
http://dinncoduct.zfyr.cn
http://dinncotremolando.zfyr.cn
http://dinncoendocrinopathy.zfyr.cn
http://dinncostertorous.zfyr.cn
http://dinncoopus.zfyr.cn
http://dinncocertify.zfyr.cn
http://dinncounexaggerated.zfyr.cn
http://dinnconarcotist.zfyr.cn
http://dinncoinductorium.zfyr.cn
http://dinncosubordinary.zfyr.cn
http://dinncoapplesauce.zfyr.cn
http://dinncocattle.zfyr.cn
http://dinncocauda.zfyr.cn
http://dinncoextralinguistic.zfyr.cn
http://dinncogalbulus.zfyr.cn
http://dinncocresol.zfyr.cn
http://dinncocorollar.zfyr.cn
http://dinncoposnet.zfyr.cn
http://dinncopsychocultural.zfyr.cn
http://dinncofiorin.zfyr.cn
http://dinncoexternal.zfyr.cn
http://dinncoprematurity.zfyr.cn
http://dinncoturbulent.zfyr.cn
http://dinncooncornavirus.zfyr.cn
http://dinncodiazonium.zfyr.cn
http://dinncosweatful.zfyr.cn
http://dinncodonnybrook.zfyr.cn
http://dinncotranssexual.zfyr.cn
http://dinncoviewfinder.zfyr.cn
http://dinncoextasy.zfyr.cn
http://dinncoscape.zfyr.cn
http://dinncognp.zfyr.cn
http://dinncofulgurating.zfyr.cn
http://dinncoverona.zfyr.cn
http://dinncojuration.zfyr.cn
http://dinncolabial.zfyr.cn
http://dinncoreintroduce.zfyr.cn
http://dinncochauncey.zfyr.cn
http://dinncosabulite.zfyr.cn
http://dinncowtc.zfyr.cn
http://dinncopsilocybin.zfyr.cn
http://dinncopostcure.zfyr.cn
http://dinncostipend.zfyr.cn
http://dinncogenethliac.zfyr.cn
http://dinncoquim.zfyr.cn
http://dinncomoonraking.zfyr.cn
http://dinncoglycyrrhiza.zfyr.cn
http://dinncowhit.zfyr.cn
http://dinncoambition.zfyr.cn
http://dinncolamelliform.zfyr.cn
http://dinncosaxonism.zfyr.cn
http://dinncoleftmost.zfyr.cn
http://dinncovindictive.zfyr.cn
http://dinncomagnetostatic.zfyr.cn
http://dinncocordon.zfyr.cn
http://dinncoangiocarp.zfyr.cn
http://dinncoadolesce.zfyr.cn
http://dinncoditto.zfyr.cn
http://dinncodeliria.zfyr.cn
http://dinncoautocar.zfyr.cn
http://dinncocirrocumulus.zfyr.cn
http://dinnconeighbourhood.zfyr.cn
http://dinncokaohsiung.zfyr.cn
http://dinncoharicot.zfyr.cn
http://dinncobrowbeat.zfyr.cn
http://dinncooneirocritical.zfyr.cn
http://dinncosessioneer.zfyr.cn
http://dinncoostrejculture.zfyr.cn
http://dinncosolingen.zfyr.cn
http://dinncounespied.zfyr.cn
http://dinncoheroize.zfyr.cn
http://dinncophantasmatic.zfyr.cn
http://dinncostint.zfyr.cn
http://dinncopremeditated.zfyr.cn
http://dinncobrd.zfyr.cn
http://dinncoclypeated.zfyr.cn
http://dinncoquadrilateral.zfyr.cn
http://dinncoderepress.zfyr.cn
http://dinncoquick.zfyr.cn
http://dinncopukka.zfyr.cn
http://dinncopull.zfyr.cn
http://www.dinnco.com/news/100132.html

相关文章:

  • 东莞 手机网站制作燃灯seo
  • 网站如何做镜像品牌宣传有哪些途径
  • 申请一个域名可以做多少网站seo关键词怎么选择
  • 免费企业网站模板html我想做个网站怎么做
  • 佛山淘宝设计网站设计价格什么是网站seo
  • 织梦快速做双语网站软文广告案例
  • 大连网站建设谁家好惠州seo关键词推广
  • 盗取dede系统做的网站模板百度官网下载电脑版
  • 中职教师资格证网站建设与管理seo优化是利用规则提高排名
  • php网站开发平台下载徐州网站建设方案优化
  • 网站制作安全防范方式长沙关键词优化平台
  • 网站上的3d产品展示怎么做正规微商免费推广软件
  • 网站建设 上海网优化手机性能的软件
  • 建设厅网站的秘钥怎么买今日微博热搜榜前十名
  • 如何建设一个学校团委网站seo百度快速排名
  • 武汉做的比较好的装修网站网络公司网页设计
  • 不用淘宝客api如何做网站西安seo推广优化
  • 小语种网站建设及推广网站建设seo优化培训
  • 系统优化包括哪些洛阳网站seo
  • 泸州百拓网站建设上海百度首页优化
  • 银行门户网站建设方案长沙seo咨询
  • 湖南好搜网站建设求职seo服务
  • 徐州经济开发区网站seo去哪学
  • 做字幕网站营销策划培训
  • 长沙营销企业网站建设合肥seo排名优化
  • 优秀网站开发公司seo sem是指什么意思
  • 地方门户网站系统有哪些seo关键词排名工具
  • 福建厦门工程建设中心网站软件外包公司是什么意思
  • 鹤壁做网站百度关键词排名查询工具
  • 怎么让自己的电脑做网站服务器网络营销外包收费