Results 1 to 3 of 3

Thread: What is the difference between selectionChanged & currentChanged?

  1. #1
    Join Date
    Sep 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default What is the difference between selectionChanged & currentChanged?

    Hi,

    I'm using a a QTableView to show data of QStandardItem model. For each individual cell change I'm going to update a custom data structure. However to detect the current cell change I need a signal to catch.

    I found QItemSelectionModel::currentChanged & QItemSelectionModel::selectionChanged in the documentation. Anyway I'm bit confused with these two. Can anyone please explain the different ( despite of the signatures ) purposes of these two?

    Thank you,
    Indika...

  2. #2
    Join Date
    Mar 2011
    Location
    Havana, Cuba
    Posts
    17
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: What is the difference between selectionChanged & currentChanged?

    The difference consists in the data type of the parameters of the signals, QItemSelectionModel::currentChanged receive two parameters, boths are QModelIndex data type and QItemSelectionModel::selectionChanged receive two parameters too, but this are QItemSelection data type, so in dependence of you want to do with this values you have to decide which signal to catch.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What is the difference between selectionChanged & currentChanged?

    The current cell is the one that you would edit if you started typing (or pressed F2)... it is a single cell and not necessarily related to the selection. On screen it typically has a faint box border.

    The selection is a set of highlighted cells that would typically be the target of a copy/paste/drag type action. The selection can be empty, a single cell, whole rows/columns, contiguous or disjoint collections of cells depending on options. On screen the selection is typically rendered as white text on a dark background instead of black on white like unselected cells.

Similar Threads

  1. Replies: 0
    Last Post: 8th June 2011, 13:15
  2. QItemSelectionModel and selectionChanged / currentChanged.
    By hickscorp in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2011, 22:40
  3. Replies: 6
    Last Post: 20th April 2011, 11:26
  4. Problem connecting selectionChanged
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 1st June 2009, 15:57
  5. ListView and CurrentChanged
    By kroenecker in forum Newbie
    Replies: 13
    Last Post: 24th March 2007, 02:35

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.