Commit 2707f7a7 authored by con's avatar con Committed by Eike Ziller
Browse files

Close variable chooser on escape (if it has focus).

Task-number: QTCREATORBUG-4307

Change-Id: Ib85f5fda1310fe6fb0e0824488fb6c79962ae35b
Reviewed-on: http://codereview.qt.nokia.com/624

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
parent 7827af97
......@@ -35,6 +35,8 @@
#include "variablemanager.h"
#include "coreconstants.h"
#include <QtCore/QTimer>
using namespace Core;
VariableChooser::VariableChooser(QWidget *parent) :
......@@ -175,3 +177,11 @@ void VariableChooser::insertVariable(const QString &variable)
m_plainTextEdit->activateWindow();
}
}
void VariableChooser::keyPressEvent(QKeyEvent *ke)
{
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
ke->accept();
QTimer::singleShot(0, this, SLOT(close()));
}
}
......@@ -58,6 +58,9 @@ public:
explicit VariableChooser(QWidget *parent = 0);
~VariableChooser();
protected:
void keyPressEvent(QKeyEvent *ke);
private slots:
void updateDescription(const QString &variable);
void updateCurrentEditor(QWidget *old, QWidget *widget);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment