• Qt+C++自建网页浏览器-Chrome blink最新内核基础上搭建-改进版本


     程序示例精选

    Qt+C++自建网页浏览器-Chrome blink最新内核基础上搭建-改进版本

    如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助!

    前言

    这篇博客针对<>编写代码,代码整洁,规则,易读。 学习与应用推荐首选。

    功能:网页浏览器,带视频播放,多选项卡,前进,后退功能。


    文章目录

    一、所需工具软件

    二、使用步骤

    1. 引入库

    2. 窗体界面

    3. 运行结果

    三、在线协助

    一、所需工具软件

    1. VS, Qt

    2. Win10, Win11

    二、使用步骤

    1.引入库

    代码如下(示例):

    1. #include "QUrl"
    2. #include
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include

    2.窗体界面

    代码如下(示例):

    1. QT_BEGIN_NAMESPACE
    2. class Ui_MainWindowClass
    3. {
    4. public:
    5. QAction *actionaa;
    6. QWidget *centralWidget;
    7. QGridLayout *gridLayout_3;
    8. QFrame *frame_2;
    9. QGridLayout *gridLayout_2;
    10. QComboBox *comboBox;
    11. QHBoxLayout *horizontalLayout;
    12. QPushButton *pushButton_4;
    13. QPushButton *pushButton_3;
    14. QPushButton *pushButton_2;
    15. QLineEdit *lineEdit;
    16. QPushButton *pushButton;
    17. QPushButton *pushButton_5;
    18. QPushButton *pushButton_6;
    19. QSpacerItem *horizontalSpacer;
    20. QSpacerItem *horizontalSpacer_2;
    21. QLabel *label;
    22. QFrame *frame;
    23. QGridLayout *gridLayout;
    24. QWebEngineView *webEngineView;
    25. QMenuBar *menuBar;
    26. QToolBar *mainToolBar;
    27. QStatusBar *statusBar;
    28. void setupUi(QMainWindow *MainWindowClass)
    29. {
    30. if (MainWindowClass->objectName().isEmpty())
    31. MainWindowClass->setObjectName(QString::fromUtf8("MainWindowClass"));
    32. MainWindowClass->resize(716, 400);
    33. actionaa = new QAction(MainWindowClass);
    34. actionaa->setObjectName(QString::fromUtf8("actionaa"));
    35. QIcon icon;
    36. QString iconThemeName = QString::fromUtf8("dfds");
    37. if (QIcon::hasThemeIcon(iconThemeName)) {
    38. icon = QIcon::fromTheme(iconThemeName);
    39. } else {
    40. icon.addFile(QString::fromUtf8(":/MainWindow/png/\346\211\223\345\274\200\346\226\207\344\273\266\345\244\271-\347\272\242\350\211\262.png"), QSize(), QIcon::Normal, QIcon::Off);
    41. }
    42. actionaa->setIcon(icon);
    43. centralWidget = new QWidget(MainWindowClass);
    44. centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
    45. gridLayout_3 = new QGridLayout(centralWidget);
    46. gridLayout_3->setSpacing(6);
    47. gridLayout_3->setContentsMargins(11, 11, 11, 11);
    48. gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3"));
    49. frame_2 = new QFrame(centralWidget);
    50. frame_2->setObjectName(QString::fromUtf8("frame_2"));
    51. QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    52. sizePolicy.setHorizontalStretch(1);
    53. sizePolicy.setVerticalStretch(0);
    54. sizePolicy.setHeightForWidth(frame_2->sizePolicy().hasHeightForWidth());
    55. frame_2->setSizePolicy(sizePolicy);
    56. QFont font;
    57. font.setFamily(QString::fromUtf8("3ds"));
    58. font.setPointSize(16);
    59. frame_2->setFont(font);
    60. frame_2->setFrameShape(QFrame::Box);
    61. frame_2->setFrameShadow(QFrame::Raised);
    62. gridLayout_2 = new QGridLayout(frame_2);
    63. gridLayout_2->setSpacing(6);
    64. gridLayout_2->setContentsMargins(11, 11, 11, 11);
    65. gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
    66. comboBox = new QComboBox(frame_2);
    67. comboBox->addItem(QString());
    68. comboBox->addItem(QString());
    69. comboBox->addItem(QString());
    70. comboBox->setObjectName(QString::fromUtf8("comboBox"));
    71. QFont font1;
    72. font1.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
    73. font1.setPointSize(12);
    74. comboBox->setFont(font1);
    75. gridLayout_2->addWidget(comboBox, 0, 2, 1, 1);
    76. horizontalLayout = new QHBoxLayout();
    77. horizontalLayout->setSpacing(6);
    78. horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
    79. pushButton_4 = new QPushButton(frame_2);
    80. pushButton_4->setObjectName(QString::fromUtf8("pushButton_4"));
    81. horizontalLayout->addWidget(pushButton_4);
    82. pushButton_3 = new QPushButton(frame_2);
    83. pushButton_3->setObjectName(QString::fromUtf8("pushButton_3"));
    84. horizontalLayout->addWidget(pushButton_3);
    85. pushButton_2 = new QPushButton(frame_2);
    86. pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
    87. horizontalLayout->addWidget(pushButton_2);
    88. lineEdit = new QLineEdit(frame_2);
    89. lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
    90. QFont font2;
    91. font2.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
    92. lineEdit->setFont(font2);
    93. horizontalLayout->addWidget(lineEdit);
    94. pushButton = new QPushButton(frame_2);
    95. pushButton->setObjectName(QString::fromUtf8("pushButton"));
    96. QFont font3;
    97. font3.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
    98. font3.setPointSize(16);
    99. pushButton->setFont(font3);
    100. horizontalLayout->addWidget(pushButton);
    101. pushButton_5 = new QPushButton(frame_2);
    102. pushButton_5->setObjectName(QString::fromUtf8("pushButton_5"));
    103. pushButton_5->setFont(font2);
    104. horizontalLayout->addWidget(pushButton_5);
    105. pushButton_6 = new QPushButton(frame_2);
    106. pushButton_6->setObjectName(QString::fromUtf8("pushButton_6"));
    107. pushButton_6->setFont(font2);
    108. horizontalLayout->addWidget(pushButton_6);
    109. horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    110. horizontalLayout->addItem(horizontalSpacer);
    111. gridLayout_2->addLayout(horizontalLayout, 0, 0, 1, 1);
    112. horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    113. gridLayout_2->addItem(horizontalSpacer_2, 0, 1, 1, 1);
    114. label = new QLabel(frame_2);
    115. label->setObjectName(QString::fromUtf8("label"));
    116. label->setFont(font2);
    117. gridLayout_2->addWidget(label, 0, 3, 1, 1);
    118. gridLayout_3->addWidget(frame_2, 0, 0, 1, 1);
    119. frame = new QFrame(centralWidget);
    120. frame->setObjectName(QString::fromUtf8("frame"));
    121. QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Preferred);
    122. sizePolicy1.setHorizontalStretch(0);
    123. sizePolicy1.setVerticalStretch(6);
    124. sizePolicy1.setHeightForWidth(frame->sizePolicy().hasHeightForWidth());
    125. frame->setSizePolicy(sizePolicy1);
    126. frame->setFrameShape(QFrame::Box);
    127. frame->setFrameShadow(QFrame::Raised);
    128. gridLayout = new QGridLayout(frame);
    129. gridLayout->setSpacing(5);
    130. gridLayout->setContentsMargins(11, 11, 11, 11);
    131. gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
    132. gridLayout->setContentsMargins(0, 0, 0, 0);
    133. webEngineView = new QWebEngineView(frame);
    134. webEngineView->setObjectName(QString::fromUtf8("webEngineView"));
    135. webEngineView->setUrl(QUrl(QString::fromUtf8("about:blank")));
    136. gridLayout->addWidget(webEngineView, 0, 0, 1, 1);
    137. gridLayout_3->addWidget(frame, 1, 0, 1, 1);
    138. mainToolBar->addAction(actionaa);
    139. mainToolBar->addSeparator();
    140. retranslateUi(MainWindowClass);
    141. QMetaObject::connectSlotsByName(MainWindowClass);
    142. } // setupUi
    143. void retranslateUi(QMainWindow *MainWindowClass)
    144. {
    145. MainWindowClass->setWindowTitle(QCoreApplication::translate("MainWindowClass", "MainWindow", nullptr));
    146. actionaa->setText(QCoreApplication::translate("MainWindowClass", "aa", nullptr));
    147. #if QT_CONFIG(shortcut)
    148. actionaa->setShortcut(QCoreApplication::translate("MainWindowClass", "Ctrl+O", nullptr));
    149. #endif // QT_CONFIG(shortcut)
    150. comboBox->setItemText(0, QString());
    151. comboBox->setItemText(1, QCoreApplication::translate("MainWindowClass", "www.baidu.com", nullptr));
    152. comboBox->setItemText(2, QCoreApplication::translate("MainWindowClass", "www.csdn.net", nullptr));
    153. };
    154. namespace Ui {
    155. class MainWindowClass: public Ui_MainWindowClass {};
    156. } // namespace Ui
    157. QT_END_NAMESPACE
    158. #endif // UI_MAINWINDOW_H

    3.运行结果如下

    三、在线协助:

    如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!
    1)远程安装运行环境,代码调试
    2)Qt, C++, Python入门指导
    3)界面美化
    4)软件制作

     当前文章连接:https://blog.csdn.net/alicema1111/article/details/132666851

    博主推荐文章:python人脸识别统计人数qt窗体-CSDN博客

    博主推荐文章:Python Yolov5火焰烟雾识别源码分享-CSDN博客

                             Python OpenCV识别行人入口进出人数统计_python识别人数-CSDN博客

    个人博客主页:alicema1111的博客_CSDN博客-Python,C++,网页领域博主

    博主所有文章点这里:月光码头_Python,C++,C++ VTK-CSDN博客

  • 相关阅读:
    Sora--首个大型视频生成模型
    Qt/C++音视频开发53-本地摄像头推流/桌面推流/文件推流/监控推流等
    About Covariance and Correlation(协方差和相关)
    Android-Service详解
    支付官方解析
    JavaScript:实现binarySearch二分查找算法(附完整源码)
    【Lua 入门基础篇(一)】基本语法&数据类型
    天翼云打造国云安全品牌 铸牢企业云上安全防线
    政安晨:【Keras机器学习示例演绎】(七)—— 利用 NeRF 进行 3D 体积渲染
    Linux学习——线程的控制
  • 原文地址:https://blog.csdn.net/alicema1111/article/details/132667083