Results 1 to 3 of 3

Thread: Display current row and columv value

  1. #1
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Display current row and columv value

    I am using Qt TableWidgets and I am trying to fetch the current row and column whatever is selected by user.



    I am using cellClicked SIGNAL of QTableWidget


    Qt Code:
    1. connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(removeSR(int r,int c)));
    To copy to clipboard, switch view to plain text mode 

    Through this function removeSR(int r,int c) I am trying to fetch the current row and column but it does not display the value of current row and column.


    Please send me the snippets of the code or any another way if possible.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Display current row and columv value

    Quote Originally Posted by sosanjay View Post
    but it does not display the value of current row and column.
    This is because your connection syntax is wrong! Don't put the names of your arguments there:
    Qt Code:
    1. connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(removeSR(int,int)));
    To copy to clipboard, switch view to plain text mode 

    ((And removeSR must be declared as a slot and you have to use Q_OBJECT))

  3. #3
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Display current row and columv value

    Thanks, Its working fine.

    when I Insert data in the table first time it shows from starting but next time it append from the last.

    Can it possible that current data will always show from the starting of the table.

    Like :-


    Qt Code:
    1. when I send data 1,2,3
    2.  
    3. it shows
    4. 1
    5. 2
    6. 3
    7.  
    8. and when I send data second time 4,5 it shows
    9.  
    10. 1
    11. 2
    12. 3
    13. 4
    14. 5
    15.  
    16. But I need to show in this format where 5 is the latest data
    17.  
    18. 5
    19. 4
    20. 3
    21. 2
    22. 1
    To copy to clipboard, switch view to plain text mode 

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.