From f1d270540c82b8ded2c1eeed7c0c21c691631767 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Wed, 19 May 2021 09:19:40 +0800 Subject: [PATCH 1/2] Automatic completion won't work in next search after clicked actions in detial widget. --- src/content-widget.cpp | 3 ++- src/content-widget.h | 2 +- src/control/search-detail-view.cpp | 1 + src/control/search-detail-view.h | 1 + src/mainwindow.cpp | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/content-widget.cpp b/src/content-widget.cpp index 7d7103d..e289b41 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -91,6 +91,7 @@ void ContentWidget::initUI() { clearLayout(m_homePageLyt); initHomePage(); }); + connect(m_detailView, &SearchDetailView::actionTriggerd, this, &ContentWidget::effectiveSearch); m_resultDetailArea->setWidget(m_detailView); m_resultDetailArea->setWidgetResizable(true); m_resultListArea->setFrameShape(QFrame::NoFrame); @@ -283,7 +284,7 @@ void ContentWidget::setupConnect(SearchListView * listview) { connect(listview, &SearchListView::currentSelectPos, [ = ](QPoint pos) { m_resultListArea->ensureVisible(pos.x(), pos.y()); }); - connect(listview, &SearchListView::mousePressed, this, &ContentWidget::mousePressed); + connect(listview, &SearchListView::mousePressed, this, &ContentWidget::effectiveSearch); connect(listview, &SearchListView::currentRowChanged, this, &ContentWidget::onListViewRowChanged); connect(listview, &SearchListView::onRowDoubleClicked, this, &ContentWidget::onListViewRowDoubleClicked); } diff --git a/src/content-widget.h b/src/content-widget.h index 5f5132b..d57e956 100644 --- a/src/content-widget.h +++ b/src/content-widget.h @@ -109,7 +109,7 @@ private: Q_SIGNALS: void currentItemChanged(); - void mousePressed(); + void effectiveSearch(); private Q_SLOTS: void clearLayout(QLayout *); diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index cd0d551..291547f 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -406,6 +406,7 @@ void SearchDetailView::execActions(const int& type, const int& option, const QSt default: break; } + Q_EMIT this->actionTriggerd(); } /** diff --git a/src/control/search-detail-view.h b/src/control/search-detail-view.h index a06cf87..0d5770a 100644 --- a/src/control/search-detail-view.h +++ b/src/control/search-detail-view.h @@ -105,6 +105,7 @@ private: Q_SIGNALS: void configFileChanged(); + void actionTriggerd(); private Q_SLOTS: void execActions(const int&, const int&, const QString&); void refreshIcon(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3d15fb2..305366a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -253,7 +253,7 @@ void MainWindow::initUi() { mainlayout->addWidget(m_titleFrame); mainlayout->addWidget(m_contentFrame); mainlayout->addWidget(m_searchWidget); - connect(m_contentFrame, &ContentWidget::mousePressed, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord); + connect(m_contentFrame, &ContentWidget::effectiveSearch, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord); connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, &MainWindow::monitorResolutionChange); From d9720d2b6772a875181258ccbe4ae24101f6985d Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Wed, 19 May 2021 14:29:26 +0800 Subject: [PATCH 2/2] Modified search plugin iface. --- libsearch/plugininterface/search-plugin-iface.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsearch/plugininterface/search-plugin-iface.h b/libsearch/plugininterface/search-plugin-iface.h index a2cb769..4b1345a 100644 --- a/libsearch/plugininterface/search-plugin-iface.h +++ b/libsearch/plugininterface/search-plugin-iface.h @@ -24,12 +24,13 @@ public: QIcon icon; QString name; QVector description; - QMap actionMap;//action name and action key + QStringList actionList; //all actions, take fist for double click action. + QString key; }; virtual ~SearchPluginIface() {} virtual QString getPluginName() = 0; virtual void KeywordSearch(QString keyword,QQueue *searchResult) = 0; - virtual void openAction(QString name, QString key) = 0; + virtual void openAction(QString action, QString key) = 0; }; }