Results 1 to 4 of 4

Thread: cell selection in QTableView

  1. #1
    Join Date
    May 2007
    Location
    Australia
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default cell selection in QTableView

    I have a QTableView using QSpinBox delegate and a dial which is not part of the table.
    I want the dial to be updated when I change cells in a specific column.
    This works well when I connect the clicked(const QModelIndex &) signal of QStandardItemModel (for my table) and check which cell was clicked.

    My problem is that the user can use the arrow keys and enter key to navigate the table. In this case my previously mentioned clicked signal is not called and I can't update the dial.
    I've tried other signals (activated, entered) but they don't seem to be called.
    Is there a way to know that a cell selection was changed? I don't care if the user used a mouse click or arrow key to navigate the table, so ideally I would like to use the same method for both if possible.

  2. #2
    Join Date
    May 2008
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4

    Default Re: cell selection in QTableView

    Hi,

    You better use this signal
    tableWidget_cellClicked(int,int)
    {
    So from here you can get the current row and column of the QTabeWidget

    }

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

  4. The following user says thank you to jpn for this useful post:

    user (26th May 2008)

  5. #4
    Join Date
    May 2007
    Location
    Australia
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cell selection in QTableView

    Thank you JPN, That is what I needed.

Similar Threads

  1. how to color a cell in a QTableView
    By JeanC in forum Qt Programming
    Replies: 13
    Last Post: 9th September 2015, 10:08
  2. How to select a cell in a QTableView
    By JeanC in forum Qt Programming
    Replies: 6
    Last Post: 6th February 2008, 13:20
  3. QTableView Row Selection
    By ToddAtWSU in forum Qt Programming
    Replies: 8
    Last Post: 12th December 2007, 21:27
  4. Selection of cell with QWidget in QTableWidget
    By Tamara in forum Qt Programming
    Replies: 7
    Last Post: 17th February 2007, 14:11
  5. CheckBox and selection in QTableView
    By Mike Krus in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2006, 20:31

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.