Fix bug#127732 & bug#127792 the ukui-search do not quit while losing focus.
This commit is contained in:
parent
4b675befab
commit
a0be94c524
|
@ -32,6 +32,7 @@
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
#include <KWindowEffects>
|
#include <KWindowEffects>
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#include <QtX11Extras/QX11Info>
|
#include <QtX11Extras/QX11Info>
|
||||||
#include "ukuistylehelper/ukuistylehelper.h"
|
#include "ukuistylehelper/ukuistylehelper.h"
|
||||||
|
@ -81,11 +82,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
initConnections();
|
initConnections();
|
||||||
initGsettings();
|
initGsettings();
|
||||||
|
|
||||||
connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this,[&](WId activeWindowId){
|
// connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this,[&](WId activeWindowId){
|
||||||
if (activeWindowId != this->winId()) {
|
// qDebug() << "activeWindowChanged!!!" << activeWindowId;
|
||||||
tryHideMainwindow();
|
// if (activeWindowId != this->winId()) {
|
||||||
}
|
// tryHideMainwindow();
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
//NEW_TODO, register plugins
|
//NEW_TODO, register plugins
|
||||||
// SearchPluginManager::getInstance()->registerPlugin(\\);
|
// SearchPluginManager::getInstance()->registerPlugin(\\);
|
||||||
|
@ -571,11 +573,21 @@ void MainWindow::paintEvent(QPaintEvent *event) {
|
||||||
|
|
||||||
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
//kwin alt+f4发出close事件, 需要在存在子窗口时屏蔽该事件
|
if (watched == this) {
|
||||||
if ((watched == this) && (event->type() == QEvent::Close)) {
|
//失焦退出
|
||||||
event->ignore();
|
if (event->type() == QEvent::ActivationChange) {
|
||||||
tryHideMainwindow();
|
if (QApplication::activeWindow() != this) {
|
||||||
return true;
|
tryHideMainwindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//kwin alt+f4发出close事件, 需要在存在子窗口时屏蔽该事件
|
||||||
|
if (event->type() == QEvent::Close) {
|
||||||
|
event->ignore();
|
||||||
|
tryHideMainwindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QObject::eventFilter(watched, event);
|
return QObject::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue