Fix window exiting problem caused by shortcut keys to grab focus.
This commit is contained in:
parent
28ca6873c1
commit
7d5792eabb
|
@ -78,6 +78,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
installEventFilter(this);
|
||||
initConnections();
|
||||
initGsettings();
|
||||
|
||||
connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this,[&](WId activeWindowId){
|
||||
if (activeWindowId != this->winId()) {
|
||||
tryHideMainwindow();
|
||||
}
|
||||
});
|
||||
|
||||
//NEW_TODO, register plugins
|
||||
// SearchPluginManager::getInstance()->registerPlugin(\\);
|
||||
// m_stackedWidget->setPlugins(SearchPluginManager::getInstance()->getPluginIds());
|
||||
|
@ -537,17 +544,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
|||
return QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::ActivationChange) {
|
||||
qDebug() << "QEvent::ActivationChange!!!!" << "active" << (QApplication::activeWindow() == this) << "isVisble" << (this->isVisible());
|
||||
if(QApplication::activeWindow() != this) {
|
||||
tryHideMainwindow();
|
||||
}
|
||||
}
|
||||
return QMainWindow::eventFilter(watched,event);
|
||||
}
|
||||
|
||||
void MainWindow::paintEvent(QPaintEvent *event) {
|
||||
|
||||
QPainterPath path;
|
||||
|
|
|
@ -81,7 +81,6 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
void initUi();
|
||||
void initConnections();
|
||||
|
||||
|
|
Loading…
Reference in New Issue