Results 1 to 9 of 9

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

Hybrid View

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

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

    I created custom TableWidget and custom signal. The custom signal emits the row, column numbers and object name.
    First on cellActivated(int,int) signal I'm invkoing getRowCol(int, int) slot and in that I'm getting object name & emitting another signal with row, col, objName. All this in CTableWidget class (custom QTableWidget) and created objects of this.
    But the slot getRowCol() is not invoked on click of any cell and I've checked this with qDebug() message also. Any reason ?
    Thank you.
    Last edited by rawfool; 27th April 2013 at 10:51.

  2. #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

    1. Make sure class definition has Q_OBJECT macro
    2. Is there any message in the application output?
    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.

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

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

    Yes Q_OBJECT macro is added by default.

    2. Is there any message in the application output?
    Application runs quite normal. No spl message in output on running the application.

    Thank you very much for your help.

  4. #4
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    52
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 9 Times in 9 Posts

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

    once try with cellClicked ( int row, int column ) signal ... and check ...

  5. The following user says thank you to pradeepreddyg95 for this useful post:

    rawfool (29th April 2013)

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

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

    Oh! that was the problem. I used cellActivated(int,int)) instead of cellClicked(int,int).
    I read the documentation, but didn't understand between the two. What is the difference between cellActivated(int,int)) and cellClicked(int,int) ?

    Thank you Pradeep and Santosh.

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.