[PyQt] selectionChanged or currentChanged in QTreeView
    Hans Meine 
    meine at informatik.uni-hamburg.de
       
    Thu Oct  7 08:09:55 BST 2010
    
    
  
Am Donnerstag 07 Oktober 2010, 00:40:28 schrieb danny:
> My app constructs a tree by drag and drop. When I drop a node, I
> immediately make that node current and edit it's text. The execution order
> seems to selectionChanged, then currentChanged. The activated signal never
> fires  at all.
activated = double-click / enter, used e.g. as a shortcut for the default 
action (opening a file / open property dialog)
current = "cursor", there's always *one* current item (not necessarily 
selected; in the widget style I use it is marked with a dotted frame)
selection = interacts with selectionMode and several other variables, complex 
concept that can contain one or more items, or be disabled altogether
> FWIW, in opposition to what you say, selectionChanged and
> currentChanged always seem to fire together. I have not yet seen a case
> where only one fires.
That's because of your selectionMode.  For instance, you can make some items 
unselectable, and still move the cursor over all items (currentChanged); the 
selection will "lag" behind until you reach a selectable item 
(selectionChanged again).
Anyhow, I would use the currentChanged signal if you're interested in a single 
currently highlighted item, or activated if you connect to more expensive / 
interruptive operations that should be more explicitly activated.
HTH,
  Hans
    
    
More information about the PyQt
mailing list