[PyQt] qtable object

David Boddie david at boddie.org.uk
Mon Jan 7 23:09:11 GMT 2008


On Mon Dec 24 17:24:58 GMT 2007, Jean-Baptiste BUTET wrote:

> I would like to be able to select a qtable object in order to copy and
> paste it in a sheet for example.
> 
> Qtable is Qtdesigner made.
> when I select all, only last cell is copied. (only string in cells)
> 
> Could someone explain me mechanisms in order to allow selection of qtable
> then paste on an other soft ?

It's been quite a while since I last looked at PyQt3, but here's what I
think you should try:

 1. Call the QTable's numSelections() method to get the number of selections.
    (If you are using the "Multi" selection mode, there may be more than one
    of them).
 2. Pass each selection number (from zero up to, but excluding, the total) to
    the table's selection() method to obtain a QTableSelection for each
    selection.
 3. Using the cell row and column limits from each QTableSelection, pass row
    and column numbers to the QTable's text() method to get text for each
    cell.

Maybe there's an easier way to do this. Let us know if you find one.

David



More information about the PyQt mailing list