!4 修复部分UI问题 * Add a mainWindow switch dbus interface. * Fix#125632 action label's color doesn't change whth the heightlight color. * Fix#127327 adjust the heightlight effect of ukcc plugin's switchbutton * 处理富文本超长问题 * 解决结果列表点击收起按钮时位置错误的问题 * 优化关键词高亮方案,结果项显示效果适配主题框架。 * 修复标题栏展开置顶后,点击收回位置错误问题
This commit is contained in:
parent
e28601e91f
commit
c504d23bc5
498
debian/patches/0004-4-UI-Add-a-mainWindow-switch-dbus-interface.-Fix-125.patch
vendored
Normal file
498
debian/patches/0004-4-UI-Add-a-mainWindow-switch-dbus-interface.-Fix-125.patch
vendored
Normal file
|
@ -0,0 +1,498 @@
|
|||
From: cckylin-cibot <cckylin-cibot@kylinos.cn>
|
||||
Date: Tue, 12 Jul 2022 10:52:42 +0000
|
||||
Subject: =?utf-8?b?ITQg5L+u5aSN6YOo5YiGVUnpl67popggKiBBZGQgYSBtYWluV2luZG93?=
|
||||
=?utf-8?b?IHN3aXRjaCBkYnVzIGludGVyZmFjZS4gKiBGaXgjMTI1NjMyIGFjdGlvbiBsYWJl?=
|
||||
=?utf-8?b?bCdzIGNvbG9yIGRvZXNuJ3QgY2hhbmdlIHdodGggdGhlIGhlaWdodGxpZ2h0IGNv?=
|
||||
=?utf-8?b?bG9yLiAqIEZpeCMxMjczMjcgYWRqdXN0IHRoZSBoZWlnaHRsaWdodCBlZmZlY3Qg?=
|
||||
=?utf-8?b?b2YgdWtjYyBwbHVnaW4ncyBzd2l0Y2hidXR0b24gKiDlpITnkIblr4zmlofmnKw=?=
|
||||
=?utf-8?b?6LaF6ZW/6Zeu6aKYICog6Kej5Yaz57uT5p6c5YiX6KGo54K55Ye75pS26LW35oyJ?=
|
||||
=?utf-8?b?6ZKu5pe25L2N572u6ZSZ6K+v55qE6Zeu6aKYICog5LyY5YyW5YWz6ZSu6K+N6auY?=
|
||||
=?utf-8?b?5Lqu5pa55qGI77yM57uT5p6c6aG55pi+56S65pWI5p6c6YCC6YWN5Li76aKY5qGG?=
|
||||
=?utf-8?b?5p6244CCICog5L+u5aSN5qCH6aKY5qCP5bGV5byA572u6aG25ZCO77yM54K55Ye7?=
|
||||
=?utf-8?b?5pS25Zue5L2N572u6ZSZ6K+v6Zeu6aKY?=
|
||||
|
||||
---
|
||||
.../control/stack-pages/search-page-section.cpp | 7 +-
|
||||
frontend/mainwindow.cpp | 5 +
|
||||
frontend/mainwindow.h | 1 +
|
||||
frontend/ukui-search-dbus-service.cpp | 9 ++
|
||||
frontend/ukui-search-dbus-service.h | 3 +-
|
||||
frontend/view/result-view-delegate.cpp | 125 +++++++++------------
|
||||
frontend/view/result-view-delegate.h | 30 ++++-
|
||||
libsearch/libsearch.pro | 2 +-
|
||||
libsearch/plugininterface/action-label.cpp | 48 ++++----
|
||||
libsearch/plugininterface/action-label.h | 3 +-
|
||||
search-ukcc-plugin/search-ukcc-plugin.pro | 2 +-
|
||||
search-ukcc-plugin/search.cpp | 4 +-
|
||||
search-ukcc-plugin/search.h | 4 +-
|
||||
13 files changed, 133 insertions(+), 110 deletions(-)
|
||||
|
||||
diff --git a/frontend/control/stack-pages/search-page-section.cpp b/frontend/control/stack-pages/search-page-section.cpp
|
||||
index 0863023..b363fd1 100644
|
||||
--- a/frontend/control/stack-pages/search-page-section.cpp
|
||||
+++ b/frontend/control/stack-pages/search-page-section.cpp
|
||||
@@ -458,12 +458,13 @@ void ResultArea::initConnections()
|
||||
connect(this->m_titleLabel, &TitleLabel::retractClicked, this, [=] () {
|
||||
Q_FOREACH(auto widget, m_widget_list) {
|
||||
if (widget->pluginName() == m_titleLabel->text()) {
|
||||
- widget->reduceListSlot();
|
||||
- widget->resetTitleLabel();
|
||||
if (!m_titleLabel->isHidden()) {
|
||||
m_titleLabel->hide();
|
||||
this->setViewportMargins(0,0,0,0);
|
||||
}
|
||||
+ widget->reduceListSlot();
|
||||
+ this->verticalScrollBar()->setValue(widget->pos().ry());
|
||||
+ widget->resetTitleLabel();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -510,8 +511,8 @@ void ResultArea::setupConnectionsForWidget(ResultWidget *widget)
|
||||
});
|
||||
connect(widget, &ResultWidget::retractClicked, this, [=] () {//点击收起搜索结果后
|
||||
if (!m_titleLabel->isHidden()) {
|
||||
- m_titleLabel->hide();
|
||||
this->setViewportMargins(0,0,0,0);
|
||||
+ m_titleLabel->hide();
|
||||
}
|
||||
});
|
||||
connect(widget, &ResultWidget::sendBestListData, m_bestListWidget, &BestListWidget::sendBestListData);
|
||||
diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp
|
||||
index feb0d59..c520361 100644
|
||||
--- a/frontend/mainwindow.cpp
|
||||
+++ b/frontend/mainwindow.cpp
|
||||
@@ -327,6 +327,11 @@ void MainWindow::resizeHeight(int height)
|
||||
this->setFixedHeight(height);
|
||||
}
|
||||
|
||||
+void MainWindow::tryHide()
|
||||
+{
|
||||
+ this->tryHideMainwindow();
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* @brief monitorResolutionChange 监听屏幕改变
|
||||
* @param rect
|
||||
diff --git a/frontend/mainwindow.h b/frontend/mainwindow.h
|
||||
index 2558654..124ca4d 100644
|
||||
--- a/frontend/mainwindow.h
|
||||
+++ b/frontend/mainwindow.h
|
||||
@@ -110,6 +110,7 @@ public Q_SLOTS:
|
||||
void settingsBtnClickedSlot();
|
||||
void searchKeywordSlot(const QString&);
|
||||
void resizeHeight(int height);
|
||||
+ void tryHide();
|
||||
|
||||
private:
|
||||
|
||||
diff --git a/frontend/ukui-search-dbus-service.cpp b/frontend/ukui-search-dbus-service.cpp
|
||||
index 7a29e83..58d7110 100644
|
||||
--- a/frontend/ukui-search-dbus-service.cpp
|
||||
+++ b/frontend/ukui-search-dbus-service.cpp
|
||||
@@ -12,6 +12,15 @@ void UkuiSearchDbusServices::searchKeyword(QString keyword)
|
||||
m_mainWindow->setText(keyword);
|
||||
}
|
||||
|
||||
+void UkuiSearchDbusServices::mainWindowSwitch()
|
||||
+{
|
||||
+ if (m_mainWindow->isActiveWindow()) {
|
||||
+ m_mainWindow->tryHide();
|
||||
+ } else {
|
||||
+ m_mainWindow->bootOptionsFilter("-s");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
UkuiSearchDbusServices::UkuiSearchDbusServices(MainWindow *m)
|
||||
{
|
||||
m_mainWindow = m;
|
||||
diff --git a/frontend/ukui-search-dbus-service.h b/frontend/ukui-search-dbus-service.h
|
||||
index d3d13be..58eb25d 100644
|
||||
--- a/frontend/ukui-search-dbus-service.h
|
||||
+++ b/frontend/ukui-search-dbus-service.h
|
||||
@@ -20,9 +20,10 @@ public:
|
||||
public Q_SLOTS:
|
||||
void showWindow();
|
||||
void searchKeyword(QString keyword);
|
||||
+ void mainWindowSwitch();
|
||||
|
||||
private:
|
||||
- MainWindow *m_mainWindow;
|
||||
+ MainWindow *m_mainWindow = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
diff --git a/frontend/view/result-view-delegate.cpp b/frontend/view/result-view-delegate.cpp
|
||||
index 6cd149c..3bc81b5 100644
|
||||
--- a/frontend/view/result-view-delegate.cpp
|
||||
+++ b/frontend/view/result-view-delegate.cpp
|
||||
@@ -3,15 +3,15 @@
|
||||
using namespace UkuiSearch;
|
||||
static ResultItemStyle *global_instance_of_item_style = nullptr;
|
||||
|
||||
-ResultViewDelegate::ResultViewDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
||||
+ResultViewDelegate::ResultViewDelegate(QObject *parent) : QStyledItemDelegate(parent),
|
||||
+ m_textDoc(new QTextDocument(this)),
|
||||
+ m_hightLightEffectHelper(new HightLightEffectHelper(this))
|
||||
{
|
||||
-
|
||||
}
|
||||
|
||||
void ResultViewDelegate::setSearchKeyword(const QString ®FindKeyWords)
|
||||
{
|
||||
- m_regFindKeyWords.clear();
|
||||
- m_regFindKeyWords = regFindKeyWords;
|
||||
+ m_hightLightEffectHelper->setExpression(regFindKeyWords);
|
||||
}
|
||||
|
||||
QSize ResultViewDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
@@ -21,90 +21,36 @@ QSize ResultViewDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
|
||||
return size;
|
||||
}
|
||||
|
||||
-void ResultViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
||||
+void ResultViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
+{
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
- QStyle *style = opt.widget->style();
|
||||
+ opt.displayAlignment = Qt::Alignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
|
||||
QString text = opt.text;
|
||||
- if(text.isEmpty()) {
|
||||
- return;
|
||||
- }
|
||||
opt.text = QString();
|
||||
- style->proxy()->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget); //绘制非文本区域内容
|
||||
-
|
||||
- opt.text = text;
|
||||
- QTextDocument doc;
|
||||
- doc.setHtml(getHtmlText(painter, opt, index)); //提取富文本
|
||||
- QAbstractTextDocumentLayout* layout = doc.documentLayout();
|
||||
- const double height = layout->documentSize().height();
|
||||
|
||||
+ QStyle *style = opt.widget->style();
|
||||
+ style->proxy()->drawControl(QStyle::CE_ItemViewItem, &opt, painter, opt.widget); //绘制非文本区域内容
|
||||
|
||||
QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &opt, opt.widget);
|
||||
- //使图标和文本间隔与原来保持一致,故文本区域右移4
|
||||
-// textRect.adjust(4, 0, 0, 0);
|
||||
- double y = textRect.y();
|
||||
- y += (textRect.height() - height) / 2;
|
||||
-
|
||||
- QAbstractTextDocumentLayout::PaintContext context;
|
||||
-
|
||||
- QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled
|
||||
- ? QPalette::Normal : QPalette::Disabled;
|
||||
- if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active))
|
||||
- cg = QPalette::Inactive;
|
||||
+ QFontMetrics fontMetrics(opt.font);
|
||||
+ text = fontMetrics.elidedText(text, Qt::ElideRight, textRect.width() - 5); //富余5px的宽度
|
||||
+ opt.text = text;
|
||||
|
||||
+ painter->save();
|
||||
if(opt.state & QStyle::State_Selected) {
|
||||
- painter->setPen(opt.palette.color(cg, QPalette::HighlightedText));
|
||||
+ m_hightLightEffectHelper->setTextColor(QBrush(opt.palette.highlightedText().color()));
|
||||
} else {
|
||||
- painter->setPen(opt.palette.color(cg, QPalette::Text));
|
||||
+ m_hightLightEffectHelper->setTextColor(QBrush(opt.palette.text().color()));
|
||||
}
|
||||
- painter->save();
|
||||
- painter->translate(QPointF(textRect.x(), y));
|
||||
- layout->draw(painter, context); //绘制文本区域内容
|
||||
- painter->restore();
|
||||
-
|
||||
-}
|
||||
+ painter->translate(textRect.topLeft());
|
||||
|
||||
-QString ResultViewDelegate::getHtmlText(QPainter *painter, const QStyleOptionViewItem &itemOption, const QModelIndex &index) const
|
||||
-{
|
||||
- int indexFindLeft = 0;
|
||||
- QString indexString = index.model()->data(index, Qt::DisplayRole).toString();
|
||||
- QFont ft(painter->font().family(), GlobalSettings::getInstance()->getValue(FONT_SIZE_KEY).toInt());
|
||||
- QFontMetrics fm(ft);
|
||||
- QString indexColString = fm.elidedText(indexString, Qt::ElideRight, itemOption.rect.width() - 30 - 10); //当字体超过Item的长度时显示为省略号
|
||||
- QString htmlString;
|
||||
- if((indexColString.toUpper()).contains((m_regFindKeyWords.toUpper()))) {
|
||||
- indexFindLeft = indexColString.toUpper().indexOf(m_regFindKeyWords.toUpper()); //得到查找字体在当前整个Item字体中的位置
|
||||
- htmlString = escapeHtml(indexColString.left(indexFindLeft)) + "<b>" + escapeHtml(indexColString.mid(indexFindLeft, m_regFindKeyWords.length())) + "</b>" + escapeHtml(indexColString.right(indexColString.length() - indexFindLeft - m_regFindKeyWords.length()));
|
||||
- } else {
|
||||
- bool boldOpenned = false;
|
||||
- for(int i = 0; i < indexColString.length(); i++) {
|
||||
- if((m_regFindKeyWords.toUpper()).contains(QString(indexColString.at(i)).toUpper())) {
|
||||
- if(! boldOpenned) {
|
||||
- boldOpenned = true;
|
||||
- htmlString.append(QString("<b>"));
|
||||
- }
|
||||
- htmlString.append(escapeHtml(QString(indexColString.at(i))));
|
||||
- } else {
|
||||
- if(boldOpenned) {
|
||||
- boldOpenned = false;
|
||||
- htmlString.append(QString("</b>"));
|
||||
- }
|
||||
- htmlString.append(escapeHtml(QString(indexColString.at(i))));
|
||||
-
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-// qDebug()<<indexColString<<"---->"<<htmlString;
|
||||
- return "<pre>" + htmlString + "</pre>";
|
||||
-}
|
||||
-
|
||||
-QString ResultViewDelegate::escapeHtml(const QString &str) const
|
||||
-{
|
||||
- QString temp = str;
|
||||
- temp.replace("<", "<");
|
||||
- temp.replace(">", ">");
|
||||
- return temp;
|
||||
+ m_textDoc->setPlainText(text);
|
||||
+ m_hightLightEffectHelper->setDocument(m_textDoc);
|
||||
+ m_hightLightEffectHelper->rehighlight();
|
||||
+ m_textDoc->drawContents(painter);
|
||||
+ painter->restore();
|
||||
}
|
||||
|
||||
ResultItemStyle *ResultItemStyle::getStyle()
|
||||
@@ -259,3 +205,32 @@ void ResultItemStyle::drawControl(QStyle::ControlElement element, const QStyleOp
|
||||
break;
|
||||
}
|
||||
}
|
||||
+
|
||||
+HightLightEffectHelper::HightLightEffectHelper(QObject *parent) : QSyntaxHighlighter(parent)
|
||||
+{
|
||||
+ m_expression.setCaseSensitivity(Qt::CaseInsensitive);
|
||||
+}
|
||||
+
|
||||
+void HightLightEffectHelper::setExpression(const QString &text)
|
||||
+{
|
||||
+ m_expression.setPattern(text);
|
||||
+}
|
||||
+
|
||||
+void HightLightEffectHelper::setTextColor(const QBrush &brush)
|
||||
+{
|
||||
+ m_textCharFormat.setForeground(brush);
|
||||
+}
|
||||
+
|
||||
+void HightLightEffectHelper::highlightBlock(const QString &text)
|
||||
+{
|
||||
+ setFormat(0, text.length(), m_textCharFormat);
|
||||
+
|
||||
+ m_textCharFormat.setFontWeight(QFont::Bold);
|
||||
+ int index = text.indexOf(m_expression);
|
||||
+ while(index >= 0){
|
||||
+ int length = m_expression.matchedLength();
|
||||
+ setFormat(index, length, m_textCharFormat);
|
||||
+ index = text.indexOf(m_expression, index+length);
|
||||
+ }
|
||||
+ m_textCharFormat.setFontWeight(QFont::Normal);
|
||||
+}
|
||||
diff --git a/frontend/view/result-view-delegate.h b/frontend/view/result-view-delegate.h
|
||||
index 1263fbd..d6a177a 100644
|
||||
--- a/frontend/view/result-view-delegate.h
|
||||
+++ b/frontend/view/result-view-delegate.h
|
||||
@@ -27,10 +27,29 @@
|
||||
#include <QTextDocument>
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QProxyStyle>
|
||||
+#include <QSyntaxHighlighter>
|
||||
+#include <QTextCharFormat>
|
||||
+#include <QRegExp>
|
||||
#include "global-settings.h"
|
||||
|
||||
namespace UkuiSearch {
|
||||
-class ResultViewDelegate : public QStyledItemDelegate {
|
||||
+class HightLightEffectHelper : public QSyntaxHighlighter
|
||||
+{
|
||||
+public:
|
||||
+ explicit HightLightEffectHelper(QObject *parent = nullptr);
|
||||
+ void setExpression(const QString &text);
|
||||
+ void setTextColor(const QBrush &brush);
|
||||
+
|
||||
+protected:
|
||||
+ void highlightBlock(const QString &text);
|
||||
+
|
||||
+private:
|
||||
+ QRegExp m_expression;
|
||||
+ QTextCharFormat m_textCharFormat;
|
||||
+};
|
||||
+
|
||||
+class ResultViewDelegate : public QStyledItemDelegate
|
||||
+{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResultViewDelegate(QObject *parent = nullptr);
|
||||
@@ -38,11 +57,12 @@ public:
|
||||
void setSearchKeyword(const QString &);
|
||||
protected:
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
-private:
|
||||
- QString m_regFindKeyWords = 0;
|
||||
void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override;
|
||||
- QString getHtmlText(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const;
|
||||
- QString escapeHtml(const QString&) const;
|
||||
+
|
||||
+private:
|
||||
+ QTextDocument *m_textDoc = nullptr;
|
||||
+ HightLightEffectHelper *m_hightLightEffectHelper = nullptr;
|
||||
+
|
||||
};
|
||||
|
||||
class ResultItemStyle : public QProxyStyle
|
||||
diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro
|
||||
index f5aefef..14a51f0 100644
|
||||
--- a/libsearch/libsearch.pro
|
||||
+++ b/libsearch/libsearch.pro
|
||||
@@ -7,7 +7,7 @@ TEMPLATE = lib
|
||||
DEFINES += LIBSEARCH_LIBRARY
|
||||
CONFIG += create_pc create_prl no_install_prl
|
||||
|
||||
-PKGCONFIG += gio-2.0 glib-2.0 gio-unix-2.0 gsettings-qt poppler-qt5
|
||||
+PKGCONFIG += gio-2.0 glib-2.0 gio-unix-2.0 gsettings-qt poppler-qt5 kysdk-qtwidgets
|
||||
|
||||
CONFIG += c++11 link_pkgconfig no_keywords lrelease
|
||||
QMAKE_CXXFLAGS += -Werror=return-type -Werror=return-local-addr -Werror=uninitialized
|
||||
diff --git a/libsearch/plugininterface/action-label.cpp b/libsearch/plugininterface/action-label.cpp
|
||||
index 6af869a..90d4ae4 100644
|
||||
--- a/libsearch/plugininterface/action-label.cpp
|
||||
+++ b/libsearch/plugininterface/action-label.cpp
|
||||
@@ -22,7 +22,7 @@
|
||||
#define ACTION_HOVER_COLOR QColor(64, 169, 251, 255)
|
||||
#define ACTION_PRESS_COLOR QColor(41, 108, 217, 255)
|
||||
using namespace UkuiSearch;
|
||||
-ActionLabel::ActionLabel(const QString &action, const QString &key, QWidget *parent) : QLabel(parent)
|
||||
+ActionLabel::ActionLabel(const QString &action, const QString &key, QWidget *parent) : KBorderlessButton(parent)
|
||||
{
|
||||
m_action = action;
|
||||
m_key = key;
|
||||
@@ -33,32 +33,40 @@ ActionLabel::ActionLabel(const QString &action, const QString &key, QWidget *par
|
||||
void ActionLabel::initUi()
|
||||
{
|
||||
this->setText(m_action);
|
||||
- QPalette pal = palette();
|
||||
- pal.setColor(QPalette::WindowText, ACTION_NORMAL_COLOR);
|
||||
- pal.setColor(QPalette::Light, ACTION_HOVER_COLOR);
|
||||
- pal.setColor(QPalette::Dark, ACTION_PRESS_COLOR);
|
||||
- this->setPalette(pal);
|
||||
- this->setForegroundRole(QPalette::WindowText);
|
||||
+// QPalette pal = palette();
|
||||
+// pal.setColor(QPalette::WindowText, ACTION_NORMAL_COLOR);
|
||||
+// pal.setColor(QPalette::Light, ACTION_HOVER_COLOR);
|
||||
+// pal.setColor(QPalette::Dark, ACTION_PRESS_COLOR);
|
||||
+// this->setPalette(pal);
|
||||
+// this->setForegroundRole(QPalette::WindowText);
|
||||
this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
}
|
||||
|
||||
bool ActionLabel::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == this) {
|
||||
- if(event->type() == QEvent::MouseButtonPress) {
|
||||
- this->setForegroundRole(QPalette::Dark);
|
||||
- return true;
|
||||
- } else if(event->type() == QEvent::MouseButtonRelease) {
|
||||
+ if (event->type() == QEvent::MouseButtonRelease) {
|
||||
Q_EMIT this->actionTriggered(m_action);
|
||||
- this->setForegroundRole(QPalette::Light);
|
||||
- return true;
|
||||
- } else if(event->type() == QEvent::Enter) {
|
||||
- this->setForegroundRole(QPalette::Light);
|
||||
- return true;
|
||||
- } else if(event->type() == QEvent::Leave) {
|
||||
- this->setForegroundRole(QPalette::WindowText);
|
||||
- return true;
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
- return false;
|
||||
+
|
||||
+
|
||||
+// if (watched == this) {
|
||||
+// if(event->type() == QEvent::MouseButtonPress) {
|
||||
+// this->setForegroundRole(QPalette::Dark);
|
||||
+// return true;
|
||||
+// } else if(event->type() == QEvent::MouseButtonRelease) {
|
||||
+// Q_EMIT this->actionTriggered(m_action);
|
||||
+// this->setForegroundRole(QPalette::Light);
|
||||
+// return true;
|
||||
+// } else if(event->type() == QEvent::Enter) {
|
||||
+// this->setForegroundRole(QPalette::Light);
|
||||
+// return true;
|
||||
+// } else if(event->type() == QEvent::Leave) {
|
||||
+// this->setForegroundRole(QPalette::WindowText);
|
||||
+// return true;
|
||||
+// }
|
||||
+// }
|
||||
+ return KBorderlessButton::eventFilter(watched, event);
|
||||
}
|
||||
diff --git a/libsearch/plugininterface/action-label.h b/libsearch/plugininterface/action-label.h
|
||||
index b1f910e..d32d1f1 100644
|
||||
--- a/libsearch/plugininterface/action-label.h
|
||||
+++ b/libsearch/plugininterface/action-label.h
|
||||
@@ -23,8 +23,9 @@
|
||||
#include <QObject>
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
+#include <kborderlessbutton.h>
|
||||
namespace UkuiSearch {
|
||||
-class ActionLabel : public QLabel
|
||||
+class ActionLabel : public kdk::KBorderlessButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
diff --git a/search-ukcc-plugin/search-ukcc-plugin.pro b/search-ukcc-plugin/search-ukcc-plugin.pro
|
||||
index 8065c6f..900c877 100644
|
||||
--- a/search-ukcc-plugin/search-ukcc-plugin.pro
|
||||
+++ b/search-ukcc-plugin/search-ukcc-plugin.pro
|
||||
@@ -6,7 +6,7 @@ target.path = $$[QT_INSTALL_LIBS]/ukui-control-center/
|
||||
|
||||
CONFIG += plugin link_pkgconfig c++11 lrelease
|
||||
|
||||
-PKGCONFIG += gio-2.0 gio-unix-2.0 gsettings-qt
|
||||
+PKGCONFIG += gio-2.0 gio-unix-2.0 gsettings-qt kysdk-qtwidgets
|
||||
|
||||
LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt
|
||||
LIBS += -lukcc
|
||||
diff --git a/search-ukcc-plugin/search.cpp b/search-ukcc-plugin/search.cpp
|
||||
index 5e9153f..5b88ddd 100644
|
||||
--- a/search-ukcc-plugin/search.cpp
|
||||
+++ b/search-ukcc-plugin/search.cpp
|
||||
@@ -65,7 +65,7 @@ QWidget *Search::pluginUi()
|
||||
m_webEngineFrame->mCombox->blockSignals(false);
|
||||
}
|
||||
});
|
||||
- connect(m_searchMethodBtn, &SwitchButton::checkedChanged, this, [ = ](bool checked) {
|
||||
+ connect(m_searchMethodBtn, &kdk::KSwitchButton::stateChanged, this, [ = ](bool checked) {
|
||||
if (m_gsettings && m_gsettings->keys().contains(SEARCH_METHOD_KEY)) {
|
||||
m_gsettings->set(SEARCH_METHOD_KEY, checked);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ void Search::initUi()
|
||||
m_descLabel2->setEnabled(false);
|
||||
m_descFrameLyt->addWidget(m_descLabel1);
|
||||
m_descFrameLyt->addWidget(m_descLabel2);
|
||||
- m_searchMethodBtn = new SwitchButton(m_searchMethodFrame);
|
||||
+ m_searchMethodBtn = new kdk::KSwitchButton(m_searchMethodFrame);
|
||||
m_searchMethodLyt->addWidget(m_descFrame);
|
||||
m_searchMethodLyt->addStretch();
|
||||
m_searchMethodLyt->addWidget(m_searchMethodBtn);
|
||||
diff --git a/search-ukcc-plugin/search.h b/search-ukcc-plugin/search.h
|
||||
index 1124af3..e5f6813 100644
|
||||
--- a/search-ukcc-plugin/search.h
|
||||
+++ b/search-ukcc-plugin/search.h
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
+#include <kswitchbutton.h>
|
||||
+
|
||||
#include <ukcc/interface/interface.h>
|
||||
#include <ukcc/widgets/comboboxitem.h>
|
||||
#include <ukcc/widgets/switchbutton.h>
|
||||
@@ -75,7 +77,7 @@ private:
|
||||
QFrame *m_searchMethodFrame = nullptr;
|
||||
QHBoxLayout *m_searchMethodLyt = nullptr;
|
||||
// QLabel *m_searchMethodLabel = nullptr;
|
||||
- SwitchButton * m_searchMethodBtn = nullptr;
|
||||
+ kdk::KSwitchButton *m_searchMethodBtn = nullptr;
|
||||
//设置搜索引擎
|
||||
TitleLabel * m_webEngineLabel = nullptr;
|
||||
ComboxFrame * m_webEngineFrame = nullptr;
|
|
@ -1,3 +1,4 @@
|
|||
0001-1.patch
|
||||
0002-2-kysdk-wayland-.-Merge-pull-request-2-from-iaom-ope.patch
|
||||
0003-qurl-qstring.patch
|
||||
0004-4-UI-Add-a-mainWindow-switch-dbus-interface.-Fix-125.patch
|
||||
|
|
Loading…
Reference in New Issue