zoukankan      html  css  js  c++  java
  • Qt内置浏览器引擎WebEngine调试和分析方法


    问题背景
    H5和JS代码写好了,在浏览器里调试也一切OK,然后嵌入到Qt中,发现各种问题,这时候,如何在Qt框架下调试Web的代码呢?
    调试方法
    在Qt帮助文档中,搜索Qt WebEngine Debugging and Profiling,重点关注Qt WebEngine Developer Tools

    The Qt WebEngine module provides web developer tools that make it easy to inspect and debug layout and performance issues of any web content.
    The developer tools are accessed as a local web page using a Chromium or Qt WebEngine based browser, such as the Chrome browser.
    To activate the developer tools, start an application that uses Qt WebEngine with the command-line arguments:
    –remote-debugging-port=<port_number>
    Where <port_number> refers to a local network port. The web developer tools can then be accessed by launching a browser at the address http://localhost:<port_number>.
    Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING can be set. It can be set as either just a port working similarly to --remote-debugging-port or given both a host address and a port. The latter can be used to control which network interface to export the interface on, so that you can access the developer tools from a remote device.

    1. 设置命令行参数
    在windows命令行中输入如下参数,启动你的程序。

    YourApp.exe --remote-debugging-port=16101


    例如调试百度首页,打开百度后,在chrome浏览器里输入

    http://localhost:16101


    很熟悉的调试页面啊。

    2. 设置环境变量
    如下图所示,添加环境变量QTWEBENGINE_REMOTE_DEBUGGING,然后直接在Qt Create中debug运行即可,效果跟方法一中使用命令行参数相同。打开浏览器输入相应的端口即可,就不在贴图了。

    总结
    方法一适用于生产环境中,发现问题时的现场调试,方法二适用于开发过程中的调试。
    ————————————————
    版权声明:本文为CSDN博主「blueshaw」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/shawzg/article/details/102967768

  • 相关阅读:
    如何使用git提交代码
    Eclipse升级ADT
    android学习:android开发常见技巧设置,提高开发效率
    Apache -Common-lang包使用
    最全的常用正则表达式大全——包括校验数字、字符、一些特殊的需求等等
    Asp.Net MVC entity framework模型验证
    Activity启动模式
    http服务器交互get,put,post,delete等说明
    js模块化插件开发
    Android Asynchronous Http Client异步网络请求使用
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/12921892.html
Copyright © 2011-2022 走看看