This commit is contained in:
zhangjiaping 2021-06-03 15:32:32 +08:00
parent 6856232d51
commit f29b36b91c
6 changed files with 30 additions and 3 deletions

View File

@ -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

View File

@ -109,6 +109,7 @@ Q_SIGNALS:
private Q_SLOTS:
void execActions(const int&, const int&, const QString&);
void refreshIcon();
void resetLineColor();
};
//此类用于url拦截

View File

@ -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());

View File

@ -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) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

View File

@ -5,5 +5,6 @@
<file>res/icons/close.svg</file>
<file>res/qt-translations/qt_zh_CN.qm</file>
<file>res/icons/net-disconnected.svg</file>
<file>res/icons/system-search.symbolic.png</file>
</qresource>
</RCC>