Catch popup menus by window type, not class name.
The latter breaks for subclasses of QMenu. Follow up to review 118361. CCMAIL:martin.klapetek@gmail.com Fixes libkonq menus opened from Folder popup dialogs closing the dialog. BUG:336702
This commit is contained in:
parent
dc79190b8d
commit
4153a2c8ee
@ -28,6 +28,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include <kwindowsystem.h>
|
#include <kwindowsystem.h>
|
||||||
#include <KWindowSystem/KWindowInfo>
|
#include <KWindowSystem/KWindowInfo>
|
||||||
@ -817,7 +818,7 @@ void Dialog::focusOutEvent(QFocusEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QWindow *focusWindow = QGuiApplication::focusWindow();
|
const QWindow *focusWindow = QGuiApplication::focusWindow();
|
||||||
bool childHasFocus = focusWindow && ((focusWindow->isActive() && isAncestorOf(focusWindow)) || focusWindow->objectName() == QLatin1String("QMenuClassWindow"));
|
bool childHasFocus = focusWindow && ((focusWindow->isActive() && isAncestorOf(focusWindow)) || focusWindow->type() & Qt::Popup);
|
||||||
|
|
||||||
if (qobject_cast<const View *>(focusWindow) || (!parentHasFocus && !childHasFocus)) {
|
if (qobject_cast<const View *>(focusWindow) || (!parentHasFocus && !childHasFocus)) {
|
||||||
qDebug() << "DIALOG: hiding dialog.";
|
qDebug() << "DIALOG: hiding dialog.";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user