mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-25 07:56:33 +00:00
Support multi-line input in the python shell
This commit is contained in:
@@ -49,3 +49,17 @@ void RDLineEdit::keyPressEvent(QKeyEvent *e)
|
||||
QLineEdit::keyPressEvent(e);
|
||||
emit(keyPress(e));
|
||||
}
|
||||
|
||||
bool RDLineEdit::event(QEvent *e)
|
||||
{
|
||||
if(m_acceptTabs && e->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent *ke = (QKeyEvent *)e;
|
||||
if(ke->key() == Qt::Key_Tab)
|
||||
{
|
||||
insert(lit("\t"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QLineEdit::event(e);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ public:
|
||||
explicit RDLineEdit(QWidget *parent = 0);
|
||||
~RDLineEdit();
|
||||
|
||||
void setAcceptTabCharacters(bool accept) { m_acceptTabs = accept; }
|
||||
bool acceptTabCharacters() { return m_acceptTabs; }
|
||||
signals:
|
||||
void enter();
|
||||
void leave();
|
||||
@@ -44,4 +46,8 @@ protected:
|
||||
void focusInEvent(QFocusEvent *e);
|
||||
void focusOutEvent(QFocusEvent *e);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
bool event(QEvent *e);
|
||||
|
||||
private:
|
||||
bool m_acceptTabs;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user