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);
|
installEventFilter(this);
|
||||||
initConnections();
|
initConnections();
|
||||||
initGsettings();
|
initGsettings();
|
||||||
|
|
||||||
|
connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this,[&](WId activeWindowId){
|
||||||
|
if (activeWindowId != this->winId()) {
|
||||||
|
tryHideMainwindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//NEW_TODO, register plugins
|
//NEW_TODO, register plugins
|
||||||
// SearchPluginManager::getInstance()->registerPlugin(\\);
|
// SearchPluginManager::getInstance()->registerPlugin(\\);
|
||||||
// m_stackedWidget->setPlugins(SearchPluginManager::getInstance()->getPluginIds());
|
// m_stackedWidget->setPlugins(SearchPluginManager::getInstance()->getPluginIds());
|
||||||
|
@ -537,17 +544,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||||
return QWidget::keyPressEvent(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) {
|
void MainWindow::paintEvent(QPaintEvent *event) {
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
|
@ -81,7 +81,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
||||||
void initUi();
|
void initUi();
|
||||||
void initConnections();
|
void initConnections();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue