Fix :The input box has no focus after press win+s sometimes.
This commit is contained in:
parent
58905ea83d
commit
c74c9ba781
|
@ -102,6 +102,7 @@ SeachBarWidget::SeachBarWidget(QWidget *parent): QWidget(parent) {
|
||||||
this->setFixedSize(m_searchLineEdit->width()+20, m_searchLineEdit->height()+20);
|
this->setFixedSize(m_searchLineEdit->width()+20, m_searchLineEdit->height()+20);
|
||||||
m_ly->setContentsMargins(0,0,0,0);
|
m_ly->setContentsMargins(0,0,0,0);
|
||||||
m_ly->addWidget(m_searchLineEdit);
|
m_ly->addWidget(m_searchLineEdit);
|
||||||
|
this->setFocusProxy(m_searchLineEdit);
|
||||||
connect(m_searchLineEdit, &SearchLineEdit::requestSearchKeyword, this, &SeachBarWidget::requestSearchKeyword);
|
connect(m_searchLineEdit, &SearchLineEdit::requestSearchKeyword, this, &SeachBarWidget::requestSearchKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
this->setWindowFlag(Qt::FramelessWindowHint);
|
this->setWindowFlag(Qt::FramelessWindowHint);
|
||||||
this->setAutoFillBackground(false);
|
this->setAutoFillBackground(false);
|
||||||
this->setFocusPolicy(Qt::StrongFocus);
|
this->setFocusPolicy(Qt::StrongFocus);
|
||||||
this->setFocusProxy(this);
|
|
||||||
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
this->setWindowTitle(tr("ukui-search"));
|
this->setWindowTitle(tr("ukui-search"));
|
||||||
initUi();
|
initUi();
|
||||||
|
@ -127,6 +126,7 @@ void MainWindow::initUi() {
|
||||||
m_searchResultPage = new SearchResultPage(this);
|
m_searchResultPage = new SearchResultPage(this);
|
||||||
m_searchResultPage->hide();
|
m_searchResultPage->hide();
|
||||||
m_searchResultPage->move(0, 58);
|
m_searchResultPage->move(0, 58);
|
||||||
|
this->setFocusProxy(m_searchBarWidget);
|
||||||
|
|
||||||
// m_searchResultPage->show();
|
// m_searchResultPage->show();
|
||||||
// m_searchWidget = new SeachBarWidget(this);
|
// m_searchWidget = new SeachBarWidget(this);
|
||||||
|
@ -183,9 +183,10 @@ void MainWindow::bootOptionsFilter(QString opt) {
|
||||||
if(opt == "-s" || opt == "--show") {
|
if(opt == "-s" || opt == "--show") {
|
||||||
clearSearchResult();
|
clearSearchResult();
|
||||||
centerToScreen(this);
|
centerToScreen(this);
|
||||||
this->show();
|
if(this->isHidden()) {
|
||||||
// this->m_searchLineEdit->focusIn();
|
this->show();
|
||||||
this->raise();
|
}
|
||||||
|
this->m_searchBarWidget->setFocus();
|
||||||
this->activateWindow();
|
this->activateWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,6 +544,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||||
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::ActivationChange) {
|
if (event->type() == QEvent::ActivationChange) {
|
||||||
|
qDebug() << "QEvent::ActivationChange!!!!" << "active" << (QApplication::activeWindow() == this) << "isVisble" << (this->isVisible());
|
||||||
if(QApplication::activeWindow() != this) {
|
if(QApplication::activeWindow() != this) {
|
||||||
tryHideMainwindow();
|
tryHideMainwindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
void UkuiSearchDbusServices::showWindow(){
|
void UkuiSearchDbusServices::showWindow(){
|
||||||
|
qDebug() << "showWindow called";
|
||||||
m_mainWindow->bootOptionsFilter("-s");
|
m_mainWindow->bootOptionsFilter("-s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue