1、代码:

#include "mainwindow.h"
#include "ui_mainwindow.h" #include <QWebFrame>
#include <QWebElement>
#include <QDebug> MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
} MainWindow::~MainWindow()
{
delete ui;
} void MainWindow::on_pbtnOpenSVG_clicked()
{
ui->webView->load(QUrl::fromLocalFile("D:\\DRGIS\\BIN\\PwDrawSvg\\NewSvg.svg"));
} void PatchElement(void *_p)
{
#ifndef DEBUG_ZZ
_asm
{
push eax
mov eax,_p
mov eax,[eax+]
or [eax+0xc],0x10
pop eax
}
#else// DEBUG_ZZ
_asm
{
push eax
mov eax,_p
mov eax,[eax+]
or [eax+0x14],0x10
pop eax
}
#endif// DEBUG_ZZ
} void PatchElementUn(void *_p)
{
#ifndef DEBUG_ZZ
_asm
{
push eax
mov eax,_p
mov eax,[eax+]
and [eax+0xc],0xFFFFFFEF
pop eax
}
#else// DEBUG_ZZ
_asm
{
push eax
mov eax,_p
mov eax,[eax+]
and [eax+0x14],0xFFFFFFEF
pop eax
}
#endif// DEBUG_ZZ
} void MainWindow::on_pbtnAppendWebEle_clicked()
{
QWebElement eleSvg = ui->webView->page()->currentFrame()->documentElement();
//qDebug() << eleSvg.tagName(); QWebElement eleFind = eleSvg.findFirst("#Term_Layer");
if (eleFind.isNull())
qDebug() << "eleFind is Null";
else
qDebug() << "eleFind is not Null";
QString str = "<g id=\"zzz\"></g>";

  // ZC: 下面的 PatchElement()和PatchElementUn(),暂时是在 Release中使用,Debug中不确定一定OK...
PatchElement(&eleFind);  // ZC: 使用QWebElement::???Inside(...)的时候,就要对 那个节点 进行Patch ! ! !
eleFind.appendInside(str);
PatchElementUn(&eleFind); PatchElement(&eleFind.parent());  // ZC: 使用QWebElement::???Outside(...)的时候,就要对 那个节点的父节点 进行Patch ! ! !
eleFind.appendOutside(str);
PatchElementUn(&eleFind.parent());
} void MainWindow::on_pbtnPrintSvgContent_clicked()
{
qDebug() << ui->webView->page()->currentFrame()->toHtml();
}

2、

#-------------------------------------------------
#
# Project created by QtCreator 2018-08-15T09:00:45
#
#------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets \
webkit \
webkitwidgets TARGET = WebView_Test_01
TEMPLATE = app SOURCES += main.cpp\
mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui

3、

4、

5、

Qt5.WebView.添加节点的测试代码的更多相关文章

  1. VS添加节点

    很喜欢添加节点来减少代码的长度,方便阅读:VS快捷键和相关设置

  2. squid节点添加新域名测试

    squid节点添加新域名 测试是否缓存成功 #!/bin/bash #-- clear #清屏 方便输出结果观看 url=* #需要测试的url array_node[]="*" ...

  3. 支持阻塞操作和轮询操作的globalfifo设备驱动代码分析以及测试代码

    #include <linux/module.h> #include <linux/types.h> #include <linux/fs.h> #include ...

  4. LED字符设备驱动实例及测试代码

    驱动代码如下: #include <linux/kernel.h>//内核头文件 #include <linux/init.h>//__init等 #include <l ...

  5. Hadoop基础-MapReduce入门篇之编写简单的Wordcount测试代码

    Hadoop基础-MapReduce入门篇之编写简单的Wordcount测试代码 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 本文主要是记录一写我在学习MapReduce时的一些 ...

  6. 使用Microsoft Fakes隔离测试代码

    在单元测试(Unit Test)中我们遇到的问题之一是:假如被测试组件(类或项目)为A,组件A依赖于组件B,那么在组件A的单元测试ATest中测试A时,也需要依赖于B,在B发生改动后,就可能影响到A的 ...

  7. JQuery 添加节点

    Mark一段自己写的添加节点的代码 function reply2(){ $( "<div class=sec1-div5>"+"<div class= ...

  8. netbeans中给jpanl添加背景图片制定代码的理解——匿名内部类继承父类

    此测试是为了仿照在netbeans中给jpanl添加背景图片的制定代码的执行过程 在JpDemo中定义了个Car类的数据类型,但在给其赋值对象时使用了匿名内部类,继承了Car类,是其子类,并重写了父类 ...

  9. mvn编写主代码与测试代码

    maven编写主代码与测试代码 3.2 编写主代码 项目主代码和测试代码不同,项目的主代码会被打包到最终的构件中(比如jar),而测试代码只在运行测试时用到,不会被打包.默认情况下,Maven假设项目 ...

随机推荐

  1. Always an integer UVALive - 4119

    题目很简单,就是求表达式(P/D)的结果是不是整数.其中P是一个整系数的多项式,D是一个正整数. 把1-k(最高次)+1都试一次就好了.结论可以总结归纳得到.(k取 0, 1, 2 .... 的情况推 ...

  2. Kattis之旅——Prime Path

    The ministers of the cabinet were quite upset by the message from the Chief of Security stating that ...

  3. intelliJ IDEA之使用svn或git管理代码

    intelliJ IDEA之使用svn管理代码 1.VCS—>import into Version Control—>Share Project(Subversion) 2.点击+    ...

  4. ora-12705解决方法

    最近使用instant sqlplus测试时,遇到ora-12705,一开始以为是少了配置,经查是,NLS_LANG设置问题,设置为"SIMPLIFIED CHINESE_CHINA.ZHS ...

  5. spring @Value注解#和$区别

    一直以来,在使用@Value注解的时候,都是使用#的风格@Value("#{topic.topicName}"),但是也经常会看到@Value("${topic.topi ...

  6. Python语言知识总结

    1. 环境 1.1 Anaconda 抛弃python原生安装方式吧,使用Anaconda才是最省心的. 1.2 Miniconda Anaconda 太大了,Miniconda才是王道!下载链接:h ...

  7. 一个随机验证码且不重复的小程序以及求随机输入一组数组中的最大值(Java)

    1.代码: package day20181015;import java.util.Arrays;/** * 验证码的实现 * @author Administrator */public clas ...

  8. css 元素居中

    css 4种常见实现元素居中的办法: 1.通过 margin 属性调整 : { position: absolute; top: 50%; left: 50%; margin-left: 盒子的一半: ...

  9. java Swing小知识点

    private JTextArea jta=new JTextArea(1,2); private ScrollPane sp=new ScrollPane(); private JPasswordF ...

  10. Android系统更新防互刷功能实现与分析【转】

    本文转载自:https://blog.csdn.net/huangyabin001/article/details/44465145 版权声明:本文为博主原创文章,未经博主允许不得转载.    htt ...