
Originally Posted by
Mad Max
#include <QtGui/QApplication>
#include <QtGui/QDialog>
#include <QtGui/QTableWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLineEdit>
int main(int argc, char *argv[])
{
w.setLayout(&vboxLayout);
vboxLayout.addWidget(&edit);
table.setRowCount(1);
table.setColumnCount(3);
table.setTabKeyNavigation(false);
vboxLayout.addWidget(&table);
vboxLayout.addWidget(&edit2);
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
#include <QtGui/QApplication>
#include <QtGui/QDialog>
#include <QtGui/QTableWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLineEdit>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDialog w;
QVBoxLayout vboxLayout;
w.setLayout(&vboxLayout);
QLineEdit edit(&w);
vboxLayout.addWidget(&edit);
QTableWidget table(&w);
table.setRowCount(1);
table.setColumnCount(3);
table.setTabKeyNavigation(false);
vboxLayout.addWidget(&table);
QLineEdit edit2(&w);
vboxLayout.addWidget(&edit2);
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
To copy to clipboard, switch view to plain text mode
I observe a strange behaviour of the tab order in this form. At start it has the order: edit->table->edit2, after the editing of any column the tab order change to: edit->edit2->table. Can anyone tell me why it happen? I am in the doubts

It is solved so:
#include <QtGui/QApplication>
#include <QtGui/QDialog>
#include <QtGui/QTableWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLineEdit>
int main(int argc, char *argv[])
{
w.setLayout(&vboxLayout);
vboxLayout.addWidget(&edit);
table.setRowCount(1);
table.setColumnCount(3);
table.setTabKeyNavigation(false);
vboxLayout.addWidget(&table);
vboxLayout.addWidget(&edit2);
w.setTabOrder(&edit, &table);
w.setTabOrder(&table, &edit2);
w.setTabOrder(&edit2, &edit);
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
#include <QtGui/QApplication>
#include <QtGui/QDialog>
#include <QtGui/QTableWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLineEdit>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDialog w;
QVBoxLayout vboxLayout;
w.setLayout(&vboxLayout);
QLineEdit edit(&w);
vboxLayout.addWidget(&edit);
QTableWidget table(&w);
table.setRowCount(1);
table.setColumnCount(3);
table.setTabKeyNavigation(false);
vboxLayout.addWidget(&table);
QLineEdit edit2(&w);
vboxLayout.addWidget(&edit2);
w.setTabOrder(&edit, &table);
w.setTabOrder(&table, &edit2);
w.setTabOrder(&edit2, &edit);
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks