From e107ea3e074b6ddfa562f95dbe202597064e56a1 Mon Sep 17 00:00:00 2001 From: iaom Date: Mon, 18 Mar 2024 17:54:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=E6=90=9C=E7=B4=A2=E6=A1=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=E8=AF=B7=E6=B1=82=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=99=9A=E6=8B=9F=E9=94=AE=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/mainwindow.cpp | 22 +++------------------- frontend/mainwindow.h | 1 - 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp index 75487af..7f63474 100644 --- a/frontend/mainwindow.cpp +++ b/frontend/mainwindow.cpp @@ -173,6 +173,9 @@ void MainWindow::bootOptionsFilter(QString opt) { clearSearchResult(); centerToScreen(this); this->m_searchBarWidget->setFocus(); + QTimer::singleShot(0, [&](){ + QGuiApplication::inputMethod()->show(); + }); } this->activateWindow(); this->raise(); @@ -187,25 +190,6 @@ void MainWindow::clearSearchResult() { // m_searchLineEdit->clearFocus(); } -/** - * @brief MainWindow::trayIconActivatedSlot 点击任务栏图标的槽函数 - * @param reason - */ -void MainWindow::trayIconActivatedSlot(QSystemTrayIcon::ActivationReason reason) -{ - if(reason == QSystemTrayIcon::Trigger) { - if(!this->isVisible()) { - clearSearchResult(); - centerToScreen(this); -// this->m_searchLineEdit->focusIn(); //打开主界面时输入框夺焦,可直接输入 - this->activateWindow(); - this->raise(); - } else { - tryHideMainwindow(); - } - } -} - /** * @brief setSearchMethodConfig 在询问弹窗点击按钮后执行 * @param create_index 是否同意创建索引 diff --git a/frontend/mainwindow.h b/frontend/mainwindow.h index 3a5a4d4..1aaa4ce 100644 --- a/frontend/mainwindow.h +++ b/frontend/mainwindow.h @@ -86,7 +86,6 @@ public Q_SLOTS: void ScreenGeometryChanged(QRect rect); void bootOptionsFilter(QString opt); // 过滤终端命令 void clearSearchResult(); //清空搜索结果 - void trayIconActivatedSlot(QSystemTrayIcon::ActivationReason reason); void searchKeywordSlot(const QString&); void resizeHeight(int height); void tryHide();