Results 1 to 3 of 3

Thread: Quick question - Ways to change IDs of a buttons in a QButtonGroup

  1. #1
    Join Date
    Jul 2013
    Posts
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Quick question - Ways to change IDs of a buttons in a QButtonGroup

    Hello guys, is pretty much just the title
    To rearrange buttons in a QButtonGroup the only way I found was to re-add one by one, like
    ExampleGroupButton->addButton(ExampleGroupButton->button(i),i-1)

    Is there any other easier way to change the ID if a button in a QGroupButton?
    thanks in advance

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Quick question - Ways to change IDs of a buttons in a QButtonGroup

    QButtonGroup::setId() seems fairly obvious in the documentation.

    If you want to maintain contiguous ids after removing a button, as your example suggests, then iterating over the buttons or moving the highest id button into the gap are your options. I don't know why you would want to do this.

  3. #3
    Join Date
    Jul 2013
    Posts
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Quick question - Ways to change IDs of a buttons in a QButtonGroup

    Omg, i'm very embarrassed, sorry for the silly question...
    Thanxs anyway!

Similar Threads

  1. Using QButtonGroup in Designer - Ways to set ID?
    By zcybercomputing in forum Qt Programming
    Replies: 4
    Last Post: 30th April 2013, 06:27
  2. Replies: 0
    Last Post: 27th September 2011, 00:14
  3. Quick RegExp question
    By stealth86 in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2007, 09:23
  4. How to iterate through QButtonGroup's buttons?
    By gadnio in forum Qt Programming
    Replies: 8
    Last Post: 13th January 2006, 06: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
  •  
Qt is a trademark of The Qt Company.