Results 1 to 15 of 15

Thread: tab order and QButtonGroup and radioButton

  1. #1
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default tab order and QButtonGroup and radioButton

    If I have buttonGroup and several radio buttons, I can set focus only to first element of radioGroup, using tab.
    How to do that If i press tab, focus set to next element?

  2. #2
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    I also have made this:
    void Widget::keyPressEvent(QKeyEvent *keyEvent)
    {
    if (keyEvent->key() == Qt::Key_Tab {
    focusNextChild();
    keyEvent->accept();
    }
    }


    but this does not help me

  3. The following user says thank you to somename for this useful post:

    zoz (30th May 2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: tab order and QButtonGroup and radioButton


  5. The following user says thank you to tbscope for this useful post:

    zoz (30th May 2010)

  6. #4
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    No, it does not help..
    I have tryed this thing

  7. #5
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: tab order and QButtonGroup and radioButton

    It's an unresolved but/request.
    http://bugreports.qt.nokia.com/browse/QTBUG-131

    Use the arrow keys.
    Or as an alternative, provide your own button group.

  8. #6
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    can i inherit from QButtonGroup and setTabOrder?

  9. #7
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    I need do it, because I have widget with ButtonGroup, that consists of 5 QPushButtons with setCheckable (true);

  10. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: tab order and QButtonGroup and radioButton

    Suggestion:

    Set auto exclusive to false on all your buttons.
    Then, when you check a button, also look at the checkstate of the other 4 buttons and set them to not checked.
    This is a bit of ugly work, but then you'll get the tabs to work.

    Edit: the above description is what I actually meant with your own button group.
    The use of tabs to set the focus to the next button is disabled at the button level itself when using auto exclusive

  11. #9
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    Thanks! !

  12. #10
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    Hm.. it is not working!
    I write some app which show, that we can't using tab for move focus

    code Code:
    1. #include <QtGui>
    2.  
    3. class Widget : public QWidget
    4. {
    5. public:
    6. Widget()
    7. {
    8. buttons = new QPushButton[5];
    9.  
    10. QButtonGroup *buttonGroup = new QButtonGroup;
    11. QVBoxLayout *buttonsLayout = new QVBoxLayout;
    12. buttonGroup->setExclusive(false);
    13. for (int i = 0; i < 5; i++) {
    14. buttons[i].setAutoExclusive(false);
    15. buttons[i].setCheckable(true);
    16. buttonGroup->addButton(&buttons[i]);
    17. buttonsLayout->addWidget(&buttons[i]);
    18. buttons[i].setText("button#" + QString().setNum(i));
    19. }
    20. QVBoxLayout *mainLayout = new QVBoxLayout(this);
    21. mainLayout->addLayout(buttonsLayout);
    22.  
    23. setLayout(mainLayout);
    24. setFixedSize(sizeHint());
    25. };
    26. private:
    27. QPushButton *buttons;
    28. };
    29.  
    30. int main(int argc, char **argv)
    31. {
    32. QApplication app(argc, argv);
    33.  
    34. Widget *widget = new Widget;
    35. widget->show();
    36.  
    37. return app.exec();
    38. };
    To copy to clipboard, switch view to plain text mode 

    Any ideas?

  13. #11
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: tab order and QButtonGroup and radioButton

    I'll write you something, will take an hour or two. I'll need to finish something else first.

  14. #12
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    Ok I am waiting

  15. #13
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: tab order and QButtonGroup and radioButton


  16. The following user says thank you to tbscope for this useful post:

    somename (30th May 2010)

  17. #14
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: tab order and QButtonGroup and radioButton

    Thank you very much!

  18. #15
    Join Date
    Jan 2016
    Posts
    1
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    Windows

    Question Re: tab order and QButtonGroup and radioButton

    Quote Originally Posted by tbscope View Post
    I have also same problem but I cant open above link...can u suggest me

Similar Threads

  1. checkbox and radiobutton in treeview
    By ErmandoFerrari in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2010, 19:33
  2. radiobutton behavior on menubar
    By sp4rk3r in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2008, 04:37
  3. How to add QButtongroup to Layout?
    By pospiech in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2008, 13:22
  4. QButtonGroup usage?
    By Caius Aérobus in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2008, 07:38
  5. radiobutton output file
    By nitriles in forum Qt Programming
    Replies: 5
    Last Post: 20th September 2007, 09:04

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.