Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Change focus in TextEdit
I want change focus on Key_Tab in QTextEdit
How to do it?
Examine source got such result:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class CTextEdit : public QTextEdit
{
public:
CTextEdit(QWidget * parent = 0, const char * name = 0 ):
QTextEdit(parent,name) {};
void keyPressEvent( QKeyEvent *e )
{
bool res;
if (e->key() != Key_Tab) QTextEdit::keyPressEvent(e);
else {
QFocusEvent::setReason( QFocusEvent::Tab );
res = focusNextPrevChild( TRUE );
QFocusEvent::resetReason();
}
};
|
It's don't works.
Qt-3.0.0 Only!
|
Source code
|
1
2
3
4
5
|
void keyPressEvent( QKeyEvent *e )
{
if (e->key() != Key_Tab) QTextEdit::keyPressEvent(e);
[B]else e->ignore();[/B]
}
|
It was so simple

Now it's work fine!