PDA

View Full Version : Getting the Tab Key to Advance Through Fields



Brandon9000
14th June 2013, 16:09
I wrote a program which, under certain conditions, pops up a QWidget form. The code starts out:

void raiseForm()
{
// Main window
createTicketWindow = new QWidget();
createTicketWindow->setGeometry(600, 400,550,370);
createTicketWindow->setMinimumSize( 550, 370);
...

and then goes on to define QTextEdit boxes for the form.

Unfortunately, the tab key simply inserts a tab. I want it to take the user from one QTextEdit to the next. How do I accomplish that within this function?

Thanks.

wysota
14th June 2013, 16:35
Reimplement event() for the text edit, detect that you are handling a tab key press and call focusNextChild().

Brandon9000
14th June 2013, 21:40
I understand, but how? What class am I re-implementing it in, QWidget? My class? What does it look like?

wysota
14th June 2013, 22:31
I'm sorry, I will not code that for you. You have to do the research yourself. I have given you enough information for a good kick start. Start by looking up event() and focusNextChild().