Results 1 to 2 of 2

Thread: How to get the row number of checked radio button in QTableWidget

  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How to get the row number of checked radio button in QTableWidget

    I'm using a QTableWidget which has 62 rows and 5 columns. I have a QRadioButton on 1st column of each row.
    for(int x = 0; x < 62; x++)
    {
    rbDeviceSelect[x] = new QRadioButton();
    oDevStatePanel->setCellWidget(x, 0, rbDeviceSelect[x]);
    }
    I need to get the row number of the checked QRadioButton, from which I have to get the text from the 2nd column of the same row.
    How can I do this ?

    Thank you.

  2. #2
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: How to get the row number of checked radio button in QTableWidget

    Use QTableWidget::indexFromItem if you know the item. This method return index which is QModelIndex, and use QModelIndex::row
    Last edited by viulskiez; 26th April 2012 at 11:37. Reason: missing [qtclass] tags
    ~ We are nothing in this universe ~

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

    rawfool (26th April 2012)

Similar Threads

  1. how to check radio button
    By tommy in forum Newbie
    Replies: 2
    Last Post: 24th February 2012, 03:50
  2. Replies: 2
    Last Post: 6th June 2011, 10:40
  3. Coloring of Radio Button
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 22nd July 2008, 16:05
  4. QTreeWidgetItem + radio Button
    By desch in forum Qt Programming
    Replies: 5
    Last Post: 14th November 2007, 15:15
  5. Paint XP radio button to pixmap
    By Ben.Hines in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2006, 22:15

Tags for this Thread

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.