Results 1 to 3 of 3

Thread: QRadioButton and QButtonGroup

  1. #1
    Join Date
    Jul 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default QRadioButton and QButtonGroup

    Hi all,

    I started my C++ Gui Application and used the form to put a few components. I have two groups of QRadioButtons, but I couldn't find the way to create the groups graphically (perhaps not possible ?, I didn't find the QButtonGroup on the qt creator... ).

    So I tried to use the constructor for that:


    onOff= new QButtonGroup;
    onOff->addButton(ui->on);
    onOff->addButton(ui->off);

    metric= new QButtonGroup;
    metric->addButton(ui->m_24);
    metric->addButton(ui->m_34);
    metric->addButton(ui->m_44);
    metric->addButton(ui->m_68);


    But doesn't work either. How can I manage the radio groups ?

    thanks

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Cool Re: QRadioButton and QButtonGroup

    Go here and check the example:----

    http://www.codeprogress.com/cpp/libr...p#.UBPHXRIXUWc
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  3. #3
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QRadioButton and QButtonGroup

    reading the docs helps... button group is not a widget - you will not find it in qt designer. If you want to group buttons graphically then use a QFrame or a QGroupBox and a QLayout
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. tab order and QButtonGroup and radioButton
    By somename in forum Qt Programming
    Replies: 14
    Last Post: 12th January 2016, 12:00
  2. Can't add QButtonGroup to QGridLayout
    By migel in forum Newbie
    Replies: 1
    Last Post: 27th June 2011, 17:27
  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. How to iterate through QButtonGroup's buttons?
    By gadnio in forum Qt Programming
    Replies: 8
    Last Post: 13th January 2006, 05:06

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.