Results 1 to 4 of 4

Thread: TableView with multiple columns, emit signal when whole row is selected

  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default TableView with multiple columns, emit signal when whole row is selected

    Hello,
    I have TableView with i.e. 2 columns and n rows.
    Currently I write text, via SIGNAL(clicked(QModelIndex)), to row that was clicked. Like this:
    rows_one..jpg
    But what I want also to implement, is to emit signal when entire row is selected. Like this:
    rows..jpg

    I tried SIGNAL(activated(QModelIndex)) but this is received only when user press enter.

    As always thank you for any input/comments.
    Best regards

    Edit. Ideally I would want to emit signal when number, indicating tablerow number, is clicked (the one on the left side).
    Last edited by Talei; 25th April 2010 at 08:24. Reason: updated contents

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: TableView with multiple columns, emit signal when whole row is selected

    I think what you are looking for is QTableView::verticalHeader() and QHeaderView::sectionClicked(int):

    Qt Code:
    1. connect(yourTableView->verticalHeader(),SIGNAL(sectionClicked(int)),yourTableView,SLOT(yourSlot(int)));
    To copy to clipboard, switch view to plain text mode 

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

    Talei (26th April 2010)

  4. #3
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: TableView with multiple columns, emit signal when whole row is selected

    Thank You, that's exactly why I need.
    Best regards

  5. #4
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TableView with multiple columns, emit signal when whole row is selected

    hi Talei,
    can you post your solution code?
    Last edited by babygal; 6th October 2010 at 08:37.

Similar Threads

  1. Emit signal from thread
    By sisco in forum Newbie
    Replies: 2
    Last Post: 26th November 2009, 13:32
  2. Replies: 1
    Last Post: 12th October 2009, 09:33
  3. signal doesnt emit
    By mark2804 in forum Newbie
    Replies: 2
    Last Post: 25th December 2008, 22:36
  4. How to display selected columns in QTableView widget.
    By kaushal_gaurav in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 08:30
  5. emit a signal
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2006, 11:14

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.