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

梵高网站建设天津网站seo设计

梵高网站建设,天津网站seo设计,vr技术对网站建设有哪些影响,网站首页设计制作费用文章目录 一、环境准备 二、代码实现 三、测试 一、环境准备 首先,确保你的Qt安装包含了QtWebEngine模块。我的Qt是5.12.9并且使用MSVC来编译项目。在项目文件中需要添加以下配置,其中在Qt中配置MSVC,建议去看看这位大佬的博客&#xff1a…

文章目录

一、环境准备

二、代码实现

三、测试


一、环境准备

首先,确保你的Qt安装包含了QtWebEngine模块。我的Qt是5.12.9并且使用MSVC来编译项目。在项目文件中需要添加以下配置,其中在Qt中配置MSVC,建议去看看这位大佬的博客:Qt 添加MSVC2017编译器(2022年保姆级教程,不安装完整VS)_qt msvc2017-CSDN博客

确保:

QT += core gui webenginewidgets

二、代码实现

mainwindow.cpp,主要实现的简单网页浏览器,其通过QWebEngineView组件实现了网页内嵌功能。如下为测试demo文件代码:

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QWebEngineProfile>
#include <QStyle>
#include <QApplication>MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this);// 设置窗口标题和大小setWindowTitle("Web Browser");resize(1024, 768);// 创建工具栏toolBar = new QToolBar(this);addToolBar(toolBar);// 创建地址栏urlLineEdit = new QLineEdit(this);urlLineEdit->setPlaceholderText("Enter URL (e.g., https://www.google.com)");urlLineEdit->setStyleSheet("QLineEdit { padding: 5px; border-radius: 3px; }");toolBar->addWidget(urlLineEdit);// 创建前进按钮goButton = new QPushButton("Go", this);goButton->setStyleSheet("QPushButton { padding: 5px 15px; background-color: #4CAF50; color: white; border: none; border-radius: 3px; }""QPushButton:hover { background-color: #45a049; }");toolBar->addWidget(goButton);// 创建网页视图webView = new QWebEngineView(this);setCentralWidget(webView);// 创建进度条progressBar = new QProgressBar(this);progressBar->setMaximumHeight(2);progressBar->setTextVisible(false);progressBar->setStyleSheet("QProgressBar { border: none; background-color: #f0f0f0; }""QProgressBar::chunk { background-color: #4CAF50; }");statusBar()->addPermanentWidget(progressBar);// 连接信号和槽connect(goButton, &QPushButton::clicked, this, &MainWindow::loadPage);connect(urlLineEdit, &QLineEdit::returnPressed, this, &MainWindow::loadPage);connect(webView, &QWebEngineView::urlChanged, this, &MainWindow::updateUrl);connect(webView, &QWebEngineView::loadProgress, this, &MainWindow::updateProgress);connect(webView, &QWebEngineView::titleChanged, this, &MainWindow::updateTitle);// 设置初始页面webView->setUrl(QUrl("https://www.google.com"));
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::loadPage()
{QString url = urlLineEdit->text();if (!url.startsWith("http://") && !url.startsWith("https://")) {url = "https://" + url;}webView->setUrl(QUrl(url));
}void MainWindow::updateUrl(const QUrl &url)
{urlLineEdit->setText(url.toString());
}void MainWindow::updateProgress(int progress)
{progressBar->setValue(progress);if (progress == 100) {progressBar->hide();} else {progressBar->show();}
}void MainWindow::updateTitle(const QString &title)
{setWindowTitle(title + " - Web Browser");
}

三、测试

1.打开博客网页:

2.打开B站网页: 

 

 合理!!!!!

http://www.dtcms.com/a/607140.html

相关文章:

  • 湖州网站优化爱文者原创网
  • 使用MobaXterm在局域网里连接不上windows电脑
  • 厦门seo新站策划泗阳住房建设局网站
  • 制造业为何成为应用场景开放的“试验田”
  • 旋转位置编码(Rotary Position Embedding,RoPE)
  • 天津市开发区建设管理局网站启迪网站开发
  • 站长资源平台百度网站怎么做能中英文的
  • SpringBoot系列之CompletableFuture控制同步任务的先后执行
  • 4.2 Hive数据表操作
  • 网站开发工作经验怎么写wordpress菜单消失
  • Rust 并发实战:从零构建一个内存安全的“番茄时钟”
  • vmware做网站步骤今天天津最新通告
  • 网站后台难做吗学校网站栏目建设
  • 汇编语言编译器MASM | 深入了解MASM的使用与优化技巧
  • 可以用什么网站做mc官方新东方培训机构官网
  • 注册完域名 如何做网站红河北京网站建设
  • 基于OpenCV C++的行人检测与人流量统计算法
  • 徐州网站的优化wordpress修改模板教程
  • Spring Cloud Alibaba 组件版本选择
  • 网站开发考研是什么专业如何上传网站程序
  • 网站页面设计好了后台如何添加建设银行新版网站上线
  • 佛山网站建设定制开发网站监控的软件怎么做
  • Linux C线程编程全指南
  • 江门seo网站排名中文商城响应式html网站模板
  • 锁的初步学习
  • 淘宝网站建设的优点大连高端模板建站
  • 国外 网站源码wordpress新建页面不显示
  • locust压测如何展开
  • wordpress整站搬迁网站建设需要干什么
  • 江西建设职业技能教育咨询网站汕头市作风建设的网站