forked from qt-creator/qt-creator
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: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
This commit is contained in:
@@ -35,6 +35,8 @@
|
|||||||
#include "variablemanager.h"
|
#include "variablemanager.h"
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
|
|
||||||
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
VariableChooser::VariableChooser(QWidget *parent) :
|
VariableChooser::VariableChooser(QWidget *parent) :
|
||||||
@@ -175,3 +177,11 @@ void VariableChooser::insertVariable(const QString &variable)
|
|||||||
m_plainTextEdit->activateWindow();
|
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);
|
explicit VariableChooser(QWidget *parent = 0);
|
||||||
~VariableChooser();
|
~VariableChooser();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *ke);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateDescription(const QString &variable);
|
void updateDescription(const QString &variable);
|
||||||
void updateCurrentEditor(QWidget *old, QWidget *widget);
|
void updateCurrentEditor(QWidget *old, QWidget *widget);
|
||||||
|
|||||||
Reference in New Issue
Block a user