Add some key event logging for OpenEditorsWindow

On some platforms/configurations the popup for switching documents does
not close when releasing the modifier key. Add some debug output to try
to find out what happens.

Task-number: QTCREATORBUG-27378
Task-number: QTCREATORBUG-31228
Change-Id: Ia882ce6be1bd235601f9c869b79fb8c15ab72a3a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2024-07-10 15:25:22 +02:00
parent e7e0f80d01
commit e46ee312dd

View File

@@ -20,11 +20,14 @@
#include <QFocusEvent> #include <QFocusEvent>
#include <QHeaderView> #include <QHeaderView>
#include <QVBoxLayout> #include <QLoggingCategory>
#include <QScrollBar> #include <QScrollBar>
#include <QVBoxLayout>
using namespace Utils; using namespace Utils;
Q_LOGGING_CATEGORY(openEditorsLog, "qtc.core.openeditorswindow", QtWarningMsg);
namespace Core::Internal { namespace Core::Internal {
class OpenEditorsItem : public TreeItem class OpenEditorsItem : public TreeItem
@@ -196,9 +199,10 @@ bool OpenEditorsWindow::eventFilter(QObject *obj, QEvent *e)
} else if (e->type() == QEvent::KeyRelease) { } else if (e->type() == QEvent::KeyRelease) {
auto ke = static_cast<QKeyEvent*>(e); auto ke = static_cast<QKeyEvent*>(e);
qCDebug(openEditorsLog()) << ke;
if (ke->modifiers() == 0 if (ke->modifiers() == 0
/*HACK this is to overcome some event inconsistencies between platforms*/ /*HACK this is to overcome some event inconsistencies between platforms*/
|| (ke->modifiers() == Qt::AltModifier || (ke->modifiers() == Qt::AltModifier
&& (ke->key() == Qt::Key_Alt || ke->key() == -1))) { && (ke->key() == Qt::Key_Alt || ke->key() == -1))) {
selectAndHide(); selectAndHide();
} }