[PyQt] selection behavior of a TableView

Andreas Pakulat apaku at gmx.de
Fri Apr 3 14:03:21 BST 2009


On 03.04.09 09:36:31, Michael Wyss wrote:
> Greetings
> I am currently working on a Model-View-Delegate which works fine so far  
> but I'm not happy with the standard selection behavior and I can't find  
> a way to modify it.
> I'm using:
> View: QTableView
> Model QAbstractTableModel
> Delegate: QItemDelegate
>
> What I want is to change the Shift selection behavior of my TableView.  
> Here an example:
> What I get when selecting 1/1 shift 2/2 :
> - 1 2 3 4
> 1 x x
> 2 x x
>
> What I want when selecting 1/1 shift 2/2 :
> - 1 2 3 4
> 1 x x x x
> 2 x x

That is (AFAIK) not supported as you can only choose between whole rows or
only items to be selected. So you'll have to implement either a custom view
or try to do this by listening to selection-changed signals from the
selection model and then modify the selection everytime the user clicks...

Andreas

-- 
Try to value useful qualities in one who loves you.


More information about the PyQt mailing list