优化 UI

This commit is contained in:
Maicss 2020-07-27 12:05:40 +08:00
parent e0639a5855
commit f723007166
4 changed files with 21 additions and 8 deletions

@ -38,8 +38,10 @@ MainWindow::MainWindow(QWidget *parent)
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [ = ](DGuiApplicationHelper::ColorType themeType) {
if(themeType==DGuiApplicationHelper::DarkType){
qDebug()<<"Dark";
w->setTheme(true);
}else {
qDebug()<<"White";
w->setTheme(false);
}
});
// if(DGuiApplicationHelper::instance()-==DGuiApplicationHelper::ColorType::LightType){

@ -79,8 +79,8 @@ void Widget::initUI()
//初始化分界线
QGraphicsOpacityEffect *opacityEffect_1=new QGraphicsOpacityEffect;
QGraphicsOpacityEffect *opacityEffect_2=new QGraphicsOpacityEffect;
opacityEffect_1->setOpacity(0.2);
opacityEffect_2->setOpacity(0.2);
opacityEffect_1->setOpacity(0.1);
opacityEffect_2->setOpacity(0.1);
ui->line1_widget->setGraphicsEffect(opacityEffect_1);
ui->line2_widget->setGraphicsEffect(opacityEffect_2);
@ -113,9 +113,10 @@ void Widget::initUI()
m_loadweb->hide();
m_loaderror->hide();
m_loadweb->start();
m_loadweb->setMaximumSize(30,30);
m_loadweb->setMaximumSize(50,50);
m_loadweb->setMinimumSize(50,50);
m_loadweb->setTextVisible(false);
m_loaderror->setPixmap(QIcon::fromTheme("dialog-error").pixmap(60,60));
m_loaderror->setPixmap(QIcon::fromTheme("dialog-error").pixmap(50,50));
m_loaderror->setAlignment(Qt::AlignCenter);
ui->webView->setLayout(m_weblayout);
@ -694,6 +695,15 @@ void Widget::openUrl(QUrl u)
ui->webView->setUrl(app);
}
void Widget::setTheme(bool isDark)
{
if(isDark){
ui->widget_menuList->setStyleSheet("background-color:#282828");
}else {
ui->widget_menuList->setStyleSheet("background-color:#FFFFFF");
}
}
void Widget::on_pushButton_website_clicked()
{
QDesktopServices::openUrl(QUrl(appweb));

@ -41,6 +41,7 @@ public:
int isdownload=false;
void opensetting(); //打开设置页面
void openUrl(QUrl);
void setTheme(bool);
private slots:

@ -30,7 +30,7 @@
<number>0</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QWidget" name="widget" native="true">
<widget class="QWidget" name="widget_menuList" native="true">
<property name="minimumSize">
<size>
<width>150</width>
@ -888,7 +888,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>856</width>
<width>440</width>
<height>864</height>
</rect>
</property>
@ -1194,8 +1194,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>822</width>
<height>325</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">