ecir.hana
8th March 2013, 16:22
I try to jump with tab key between a QLineEdit and QPushButton but when I hit the key, the edit stays focused. This is the relevant code:
QWidget *widget = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
widget->setLayout(vbox);
QLineEdit *line = new QLineEdit();
QPushButton *button = new QPushButton("click");
vbox->addWidget(line);
vbox->addWidget(button);
setTabOrder(line, button);
setTabOrder(button, line);
setCentralWidget(widget);
Please, does anyone know what I'm doing wrong?
QWidget *widget = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
widget->setLayout(vbox);
QLineEdit *line = new QLineEdit();
QPushButton *button = new QPushButton("click");
vbox->addWidget(line);
vbox->addWidget(button);
setTabOrder(line, button);
setTabOrder(button, line);
setCentralWidget(widget);
Please, does anyone know what I'm doing wrong?