feat(frontend):搜索框显示时请求显示虚拟键盘

This commit is contained in:
iaom 2024-03-18 17:54:10 +08:00
parent d41c137530
commit e107ea3e07
2 changed files with 3 additions and 20 deletions

View File

@ -173,6 +173,9 @@ void MainWindow::bootOptionsFilter(QString opt) {
clearSearchResult(); clearSearchResult();
centerToScreen(this); centerToScreen(this);
this->m_searchBarWidget->setFocus(); this->m_searchBarWidget->setFocus();
QTimer::singleShot(0, [&](){
QGuiApplication::inputMethod()->show();
});
} }
this->activateWindow(); this->activateWindow();
this->raise(); this->raise();
@ -187,25 +190,6 @@ void MainWindow::clearSearchResult() {
// m_searchLineEdit->clearFocus(); // 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 * @brief setSearchMethodConfig
* @param create_index * @param create_index

View File

@ -86,7 +86,6 @@ public Q_SLOTS:
void ScreenGeometryChanged(QRect rect); void ScreenGeometryChanged(QRect rect);
void bootOptionsFilter(QString opt); // 过滤终端命令 void bootOptionsFilter(QString opt); // 过滤终端命令
void clearSearchResult(); //清空搜索结果 void clearSearchResult(); //清空搜索结果
void trayIconActivatedSlot(QSystemTrayIcon::ActivationReason reason);
void searchKeywordSlot(const QString&); void searchKeywordSlot(const QString&);
void resizeHeight(int height); void resizeHeight(int height);
void tryHide(); void tryHide();