Results 1 to 9 of 9

Thread: Out of multiple QTableWidgets how to find which one is selected

Threaded View

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

    Default Re: Out of multiple QTableWidgets how to find which one is selected

    There are couple of ways,

    1. Use the sender() to determine the signal sender, cast it to QTableWidget, but be carefule it not always safe, unless you handle it properly.
    2. Use a derived QTableWidget to emit a custom signal to include the TableWidget pointer as a signal parameter along with row and col.
    3. Use a signal mapper along side of the existing signals and pass the TableWidget QObject pointer as signal mapper signal, and then the required signal.
    4. Send a data or global data identifier as a signal parameter, instead of the QTableWidget specific row/col, that way you woun't need to bother which TableWidget has sent the signal.

    I recommend the 4th way, but it may deppend on the specific requirement.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  2. The following user says thank you to Santosh Reddy for this useful post:

    rawfool (26th April 2013)

Similar Threads

  1. Replies: 4
    Last Post: 31st January 2013, 16:40
  2. Replies: 4
    Last Post: 6th March 2011, 10:54
  3. Replies: 3
    Last Post: 6th October 2010, 09:33
  4. Replies: 2
    Last Post: 30th July 2009, 11:20
  5. undo for multiple selected items
    By mooreaa in forum Qt Programming
    Replies: 3
    Last Post: 13th July 2008, 15:13

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
  •  
Qt is a trademark of The Qt Company.