Results 1 to 7 of 7

Thread: Tab Order is Not Working

  1. #1
    Join Date
    Aug 2009
    Posts
    47
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded PyQt3 PyQt4
    Platforms
    Unix/X11 Symbian S60

    Post Tab Order is Not Working

    HI,
    In My code i set some tab order but it doesnt works pls guide me to resolve this


    mainwindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include<QtGui>
    3.  
    4.  
    5. MainWindow::MainWindow(QWidget *parent) : QDialog(parent)
    6. {
    7. buttonBox = new QDialogButtonBox(this);
    8. buttonBox->setGeometry(QRect(170, 90, 181, 34));
    9. buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
    10.  
    11. groupBox = new QGroupBox(this);
    12. groupBox->setGeometry(QRect(10, 10, 141, 80));
    13.  
    14. RB1= new QRadioButton(groupBox);
    15. RB1->setGeometry(QRect(10, 10, 121, 19));
    16. RB1->setText("Absalute Time");
    17. RB1->setChecked(true);
    18. RB1->setFocus();
    19.  
    20.  
    21. RB2 = new QRadioButton(groupBox);
    22. RB2->setGeometry(QRect(10, 40, 111, 19));
    23. RB2->setText("Relative Time");
    24.  
    25. CB1= new QComboBox(this);
    26. CB1->setGeometry(QRect(170, 20, 78, 24));
    27. CB1->addItem("1");
    28. CB1->addItem("2");
    29. CB1->addItem("3");
    30. CB1->addItem("4");
    31.  
    32. CB2 = new QComboBox(this);
    33. CB2->setGeometry(QRect(270, 20, 78, 24));
    34. CB2->addItem("1");
    35. CB2->addItem("2");
    36. CB2->addItem("3");
    37. CB2->addItem("4");
    38.  
    39. CB3 = new QComboBox(this);
    40. CB3->setGeometry(QRect(170, 50, 78, 24));
    41. CB3->addItem("1");
    42. CB3->addItem("2");
    43. CB3->addItem("3");
    44. CB3->addItem("4");
    45.  
    46. QWidget::setTabOrder(CB1,CB2);
    47. QWidget::setTabOrder(CB2,buttonBox);
    48. QWidget::setTabOrder(CB3,buttonBox);
    49.  
    50. }
    To copy to clipboard, switch view to plain text mode 

    Regards:
    Kavin

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tab Order is Not Working

    What doesnt work and what do you expect ?

  3. #3
    Join Date
    Aug 2009
    Posts
    47
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded PyQt3 PyQt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Tab Order is Not Working

    Hi,
    #
    QWidget::setTabOrder(CB1,CB2);
    #
    QWidget::setTabOrder(CB2,buttonBox);
    #
    QWidget::setTabOrder(CB3,buttonBox);
    The Above code is not working.By Pressing arrow keys the focus doent move from CB1 to CB2

    Regards
    Kavin

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tab Order is Not Working

    The focus moves by pressing 'Tab' key !!
    not arrow keys ...
    The function name itself says something

  5. #5
    Join Date
    Aug 2009
    Posts
    47
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded PyQt3 PyQt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Tab Order is Not Working

    But i want to change the focus through Arrow keys pls Guide me to do this one
    Kavin

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tab Order is Not Working

    Then you have to catch key press event in the parent widget, and use QWidget::focusNextChild to move the focus.

  7. #7
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Tab Order is Not Working

    You also need to think carefully about why you would do such a thing. Users become accustomed to keyboard navigation that follows standards; imposing a non-standard way to navigate through a GUI is possible, but is often frustrating for users and therefore not a good idea.

    To be sure, there are exceptions to everything, but you should think very carefully before inventing your own navigational paradigm.

Similar Threads

  1. tab order not working properly for radio buttons
    By netmat in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2010, 14:58
  2. setting tab order on MAC
    By gren15 in forum Qt Tools
    Replies: 0
    Last Post: 3rd July 2009, 21:08
  3. Setting Tab order
    By Rakesh_Kumar in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2009, 04:58
  4. set Tab Order in a QTableWidget
    By jfe in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2008, 12:55
  5. about tab order
    By hesummar in forum Qt Programming
    Replies: 7
    Last Post: 16th November 2006, 05:45

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.