Results 1 to 2 of 2

Thread: Can't add QButtonGroup to QGridLayout

  1. #1
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Can't add QButtonGroup to QGridLayout

    Qt Code:
    1. gridLayout = new QGridLayout;
    2. QButtonGroup *delGroup = new QButtonGroup();
    3. gridLayout->addWidget(delGroup,1 , 0, 1, 2, Qt::AlignRight);
    To copy to clipboard, switch view to plain text mode 

    ERROR:
    error: no matching function for call to 'QGridLayout::addWidget(QButtonGroup*&, int, int, int, int, Qt::AlignmentFlag)'

    QGridLayout does not inherit to widget so how do I add it to ?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Can't add QButtonGroup to QGridLayout

    QButtonGroup is not widget, it cannot be added to a layout. You need to add the actual buttons to the layout using QLayout::addWidget(), and also add the required buttons to the group using QButtonBox::addButton().

    Are you sure, you want to QButtonGroup?

Similar Threads

  1. QButtonGroup setExclusive Mac problem
    By davemar in forum Qt Programming
    Replies: 0
    Last Post: 3rd December 2010, 23:28
  2. How to add QButtongroup to Layout?
    By pospiech in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2008, 13:22
  3. QButtonGroup usage?
    By Caius Aérobus in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2008, 07:38
  4. Delete a QGridLayout and New QGridLayout at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2007, 13:01
  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.