diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index 291547f..09bac26 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -502,7 +502,6 @@ void SearchDetailView::initUI() { m_hLine = new QFrame(this); m_hLine->setLineWidth(0); m_hLine->setFixedHeight(1); - m_hLine->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}"); m_layout->addWidget(m_iconLabel); m_layout->addWidget(m_nameFrame); m_layout->addWidget(m_hLine); @@ -543,7 +542,6 @@ void SearchDetailView::initUI() { m_hLine_2 = new QFrame(this); m_hLine_2->setLineWidth(0); m_hLine_2->setFixedHeight(1); - m_hLine_2->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}"); m_layout->addWidget(m_detailFrame); m_layout->addWidget(m_hLine_2); @@ -557,6 +555,8 @@ void SearchDetailView::initUI() { m_layout->addStretch(); this->clearLayout(); //初始化时隐藏所有控件 + resetLineColor(); + connect(qApp, &QApplication::paletteChanged, this, &SearchDetailView::resetLineColor); } /** @@ -566,6 +566,17 @@ void SearchDetailView::refreshIcon() { this->setIcon(m_iconPath); } +void SearchDetailView::resetLineColor() +{ + if (GlobalSettings::getInstance()->getValue(STYLE_NAME_KEY).toString() != "ukui-dark") { + m_hLine->setStyleSheet("QFrame{background: rgba(0,0,0,0.06);}"); + m_hLine_2->setStyleSheet("QFrame{background: rgba(0,0,0,0.06);}"); + } else { + m_hLine->setStyleSheet("QFrame{background: rgba(255,255,255,0.08);}"); + m_hLine_2->setStyleSheet("QFrame{background: rgba(255,255,255,0.08);}"); + } +} + /** * @brief SearchDetailView::setIcon 设置图标区域 * @param path 图标路径或图标名 diff --git a/src/control/search-detail-view.h b/src/control/search-detail-view.h index 0d5770a..320f042 100644 --- a/src/control/search-detail-view.h +++ b/src/control/search-detail-view.h @@ -109,6 +109,7 @@ Q_SIGNALS: private Q_SLOTS: void execActions(const int&, const int&, const QString&); void refreshIcon(); + void resetLineColor(); }; //此类用于url拦截 diff --git a/src/input-box.cpp b/src/input-box.cpp index 416c69a..9396de3 100644 --- a/src/input-box.cpp +++ b/src/input-box.cpp @@ -106,6 +106,17 @@ void SearchBarHLayout::initUI() { m_queryWidget->setLayout(queryWidLayout); + if (!QIcon::fromTheme("system-search-symbolic").isNull()) { + QPixmap pixmap(QIcon::fromTheme("system-search-symbolic").pixmap(QSize(20, 20))); + m_queryIcon = new QLabel; + m_queryIcon->setFixedSize(pixmap.size()); + m_queryIcon->setPixmap(pixmap); + } else { + QPixmap pixmap(QIcon(":/res/icons/system-search.symbolic.png").pixmap(QSize(20, 20))); + m_queryIcon = new QLabel; + m_queryIcon->setFixedSize(pixmap.size()); + m_queryIcon->setPixmap(pixmap); + } QPixmap pixmap(QIcon::fromTheme("system-search-symbolic").pixmap(QSize(20, 20))); m_queryIcon = new QLabel; m_queryIcon->setFixedSize(pixmap.size()); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index be9f307..2863b07 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -110,7 +110,10 @@ MainWindow::MainWindow(QWidget *parent) : }); m_sys_tray_icon = new QSystemTrayIcon(this); - m_sys_tray_icon->setIcon(QIcon::fromTheme("system-search-symbolic")); + if (!QIcon::fromTheme("system-search-symbolic").isNull()) + m_sys_tray_icon->setIcon(QIcon::fromTheme("system-search-symbolic")); + else + m_sys_tray_icon->setIcon(QIcon(":/res/icons/system-search.symbolic.png")); m_sys_tray_icon->setToolTip(tr("Global Search")); m_sys_tray_icon->show(); connect(m_sys_tray_icon, &QSystemTrayIcon::activated, this, [ = ](QSystemTrayIcon::ActivationReason reason) { diff --git a/src/res/icons/system-search.symbolic.png b/src/res/icons/system-search.symbolic.png new file mode 100644 index 0000000..170e2a2 Binary files /dev/null and b/src/res/icons/system-search.symbolic.png differ diff --git a/src/resource.qrc b/src/resource.qrc index 018ebdd..8f84cfb 100644 --- a/src/resource.qrc +++ b/src/resource.qrc @@ -5,5 +5,6 @@ res/icons/close.svg res/qt-translations/qt_zh_CN.qm res/icons/net-disconnected.svg + res/icons/system-search.symbolic.png