jiveaxe
22nd September 2008, 11:23
Hi,
I need to change Tab key behavior for a QTextEdit so that when pressed the focus is passed to the next widget of the parent dialog (in tab order). So I have reimplemented void QWidget::keyPressEvent( QKeyEvent * event ) of my custom QTextEdit this way:
void CustomTextEdit::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Tab:
emit focusnextchild();
break;
default:
QWidget::keyPressEvent(event);
}
}
but now only the Tab key works (and the next widget is focused); pressing any other key (for inserting text in the textedit, for example) does nothing.
Where am I wrong?
I need to change Tab key behavior for a QTextEdit so that when pressed the focus is passed to the next widget of the parent dialog (in tab order). So I have reimplemented void QWidget::keyPressEvent( QKeyEvent * event ) of my custom QTextEdit this way:
void CustomTextEdit::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Tab:
emit focusnextchild();
break;
default:
QWidget::keyPressEvent(event);
}
}
but now only the Tab key works (and the next widget is focused); pressing any other key (for inserting text in the textedit, for example) does nothing.
Where am I wrong?