Results 1 to 5 of 5

Thread: how to enable buttons when multiple rows are selected in QTableWidget?

  1. #1
    Join Date
    Dec 2010
    Posts
    16
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default how to enable buttons when multiple rows are selected in QTableWidget?

    Hello,

    I am using QTableWidget in 4.3 to view a table of data, it works fine to select row(s).

    Now I want to add a button which is ENABLED when there are multiple rows are selected in the table. I understand I have to pass a bool value to the button.SetEnable(bool), but where can I get this bool value from QTableWidget?

    Thanks.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to enable buttons when multiple rows are selected in QTableWidget?

    You can use QTableWidget::getSelectedRanges to know how many rows are currently selected.

  3. #3
    Join Date
    Dec 2010
    Posts
    16
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: how to enable buttons when multiple rows are selected in QTableWidget?

    Thanks for reply.
    But when can I check the selected range? I guess there must be a signal I can catch when there are selections in the table, then I can check the selection range there? Can you help again? Thanks.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to enable buttons when multiple rows are selected in QTableWidget?

    There is a signal itemSelectionChanged in QTreeWidget, I guess it could be good idea to use it (and read docs as well).

  5. #5
    Join Date
    Dec 2010
    Posts
    16
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: how to enable buttons when multiple rows are selected in QTableWidget?

    Thank you for the help

Similar Threads

  1. Selected Rows moveUp/moveDown in QTableWidget
    By imagineryhead in forum Qt Programming
    Replies: 12
    Last Post: 14th September 2010, 15:01
  2. Show selected rows
    By mpi in forum Qt Programming
    Replies: 3
    Last Post: 23rd June 2010, 01:59
  3. QTableWidget - Select multiple rows.
    By wally in forum Qt Programming
    Replies: 2
    Last Post: 21st October 2008, 17:15
  4. removing of selected rows
    By MrShahi in forum Qt Programming
    Replies: 4
    Last Post: 10th June 2008, 15:05
  5. Replies: 5
    Last Post: 2nd April 2007, 08:57

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.