Results 1 to 2 of 2

Thread: The strange behaviour of the tab order in QTableWidget class.

  1. #1
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Exclamation The strange behaviour of the tab order in QTableWidget class.

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtGui/QDialog>
    3. #include <QtGui/QTableWidget>
    4. #include <QtGui/QVBoxLayout>
    5. #include <QtGui/QLineEdit>
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9. QVBoxLayout vboxLayout;
    10. w.setLayout(&vboxLayout);
    11. QLineEdit edit(&w);
    12. vboxLayout.addWidget(&edit);
    13. QTableWidget table(&w);
    14. table.setRowCount(1);
    15. table.setColumnCount(3);
    16. table.setTabKeyNavigation(false);
    17. vboxLayout.addWidget(&table);
    18. QLineEdit edit2(&w);
    19. vboxLayout.addWidget(&edit2);
    20. w.show();
    21. a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    22. return a.exec();
    23. }
    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

  2. #2
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The strange behaviour of the tab order in QTableWidget class.

    Quote Originally Posted by Mad Max
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtGui/QDialog>
    3. #include <QtGui/QTableWidget>
    4. #include <QtGui/QVBoxLayout>
    5. #include <QtGui/QLineEdit>
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9. QVBoxLayout vboxLayout;
    10. w.setLayout(&vboxLayout);
    11. QLineEdit edit(&w);
    12. vboxLayout.addWidget(&edit);
    13. QTableWidget table(&w);
    14. table.setRowCount(1);
    15. table.setColumnCount(3);
    16. table.setTabKeyNavigation(false);
    17. vboxLayout.addWidget(&table);
    18. QLineEdit edit2(&w);
    19. vboxLayout.addWidget(&edit2);
    20. w.show();
    21. a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    22. return a.exec();
    23. }
    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:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtGui/QDialog>
    3. #include <QtGui/QTableWidget>
    4. #include <QtGui/QVBoxLayout>
    5. #include <QtGui/QLineEdit>
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9. QVBoxLayout vboxLayout;
    10. w.setLayout(&vboxLayout);
    11. QLineEdit edit(&w);
    12. vboxLayout.addWidget(&edit);
    13. QTableWidget table(&w);
    14. table.setRowCount(1);
    15. table.setColumnCount(3);
    16. table.setTabKeyNavigation(false);
    17. vboxLayout.addWidget(&table);
    18. QLineEdit edit2(&w);
    19. vboxLayout.addWidget(&edit2);
    20.  
    21. w.setTabOrder(&edit, &table);
    22. w.setTabOrder(&table, &edit2);
    23. w.setTabOrder(&edit2, &edit);
    24.  
    25. w.show();
    26. a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    27. return a.exec();
    28. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. [Qt 4.1] Strange behaviour with QTableView
    By fane in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 06:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.