From c9c035764614687d639da2b621f88430d2074fc8 Mon Sep 17 00:00:00 2001 From: RigoLigoRLC Date: Sun, 27 Sep 2020 14:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=B7=E6=96=B0=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=88=E5=92=8CWebEngineView=E7=9A=84=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E8=8F=9C=E5=8D=95=E5=B9=B6=E5=AD=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icons.qrc | 2 + icons/refresh-page-dark.svg | 54 ++++++++++++++++++++++++ icons/refresh-page.svg | 52 +++++++++++++++++++++++ widget.cpp | 10 +++++ widget.h | 4 +- widget.ui | 82 ++++++++++++++++++++++++------------- 6 files changed, 175 insertions(+), 29 deletions(-) create mode 100644 icons/refresh-page-dark.svg create mode 100644 icons/refresh-page.svg diff --git a/icons.qrc b/icons.qrc index 5f7b0c6..0e21a94 100644 --- a/icons.qrc +++ b/icons.qrc @@ -30,6 +30,8 @@ icons/homepage_dark.svg icons/category_active_dark.svg icons/category_active.svg + icons/refresh-page-dark.svg + icons/refresh-page.svg Logo-Spark.png diff --git a/icons/refresh-page-dark.svg b/icons/refresh-page-dark.svg new file mode 100644 index 0000000..38b924c --- /dev/null +++ b/icons/refresh-page-dark.svg @@ -0,0 +1,54 @@ + +image/svg+xml + + + + diff --git a/icons/refresh-page.svg b/icons/refresh-page.svg new file mode 100644 index 0000000..bab5516 --- /dev/null +++ b/icons/refresh-page.svg @@ -0,0 +1,52 @@ + +image/svg+xml + + + + diff --git a/widget.cpp b/widget.cpp index 27041e6..aa03897 100644 --- a/widget.cpp +++ b/widget.cpp @@ -263,6 +263,7 @@ void Widget::setTheme(bool isDark,QColor color) // ui->scrollArea->setStyleSheet("background-color:#252525"); ui->label_show->setStyleSheet("background-color:#252525"); ui->pushButton_return->setIcon(QIcon(":/icons/icons/category_active_dark.svg")); + ui->pushButton_refresh->setIcon(QIcon(":/icons/icons/refresh-page-dark.svg")); }else { // 亮色模式 themeIsDark=false; @@ -273,6 +274,7 @@ void Widget::setTheme(bool isDark,QColor color) // ui->scrollArea->setStyleSheet("background-color:#F8F8F8"); ui->label_show->setStyleSheet("background-color:#F8F8F8"); ui->pushButton_return->setIcon(QIcon(":/icons/icons/category_active.svg")); + ui->pushButton_refresh->setIcon(QIcon(":/icons/icons/refresh-page.svg")); } main_color=color; m_loadweb->setTheme(themeIsDark,color); @@ -713,6 +715,14 @@ void Widget::on_pushButton_return_clicked() // } } +void Widget::on_pushButton_refresh_clicked() +{ + if(ui->stackedWidget->currentIndex() == 2) //如果在详情页面要重新触发UrlChanged + emit ui->webEngineView->urlChanged(ui->webEngineView->url()); + else + ui->webEngineView->reload(); +} + void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1) { if(configCanSave){ diff --git a/widget.h b/widget.h index 6a0fb44..ea609f4 100644 --- a/widget.h +++ b/widget.h @@ -75,7 +75,9 @@ private slots: void on_webEngineView_loadFinished(bool arg1); -public: + void on_pushButton_refresh_clicked(); + + public: QUrl url; diff --git a/widget.ui b/widget.ui index 19697a2..b159311 100644 --- a/widget.ui +++ b/widget.ui @@ -61,35 +61,35 @@ 5 - + 视频播放 - + 下载列表 - + 系统工具 - + 主题美化 - + 音乐欣赏 @@ -131,7 +131,7 @@ - + Qt::Horizontal @@ -147,14 +147,21 @@ - + 编程开发 - + + + + 办公学习 + + + + @@ -162,6 +169,9 @@ 16777215 + + 回到分类 + @@ -171,13 +181,6 @@ - - - - 办公学习 - - - @@ -191,21 +194,21 @@ - + 阅读翻译 - + 其他应用 - + @@ -215,35 +218,35 @@ - + 图形图像 - + 游戏娱乐 - + 社交沟通 - + 网络应用 - + @@ -275,6 +278,26 @@ + + + + + 40 + 16777215 + + + + 重新加载 + + + + + + + :/icons/icons/refresh-page.svg:/icons/icons/refresh-page.svg + + + @@ -287,7 +310,7 @@ 0 - 2 + 0 @@ -308,6 +331,9 @@ + + Qt::DefaultContextMenu + about:blank @@ -428,7 +454,7 @@ 0 0 - 889 + 470 854 @@ -868,8 +894,8 @@ 0 0 - 851 - 323 + 98 + 28 @@ -999,7 +1025,7 @@ 0 0 692 - 994 + 836