[PyKDE] Re: QTreeView -- selecting text within cell
Kelly Burkhart
kelly.burkhart at gmail.com
Sun Feb 4 19:27:14 GMT 2007
On 2/2/07, Kelly Burkhart <kelly.burkhart at gmail.com> wrote:
> Is it possible to select a portion of text within a cell in a
> QTreeView (or QTableView)? I would like to treat one column of cells
> as lines of text from which I can select text just like selecting in
> an editor. I do not need to select from multiple lines.
>
> Any ideas on how this can be done?
The attached is what I came up with. It's not what I thought I wanted
when I started, but I think functionally it is better.
-- You can select arbitrary cells and on X11 middle-click and the cell
contents are pasted in a sensible way.
-- You can select arbitrary cells, <copy> or <cut>, then paste the
contents somewhere else. (widget is read-only so cut doesn't modify
the contents)
-- You can double click on a cell and select text within a cell and
paste in the usual way.
If any of you see any lossage I'd love to hear it. I feel like to
some extent I've stumbled through this. ;-)
One bit that may cause problems is the TstTreeView.copySelection
method. In X11, it is called on every change to the view selection
and could get quite expensive if a big region is selected.
-K
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_treeview.py
Type: text/x-python
Size: 4087 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070204/9def6cfa/tst_treeview.py
More information about the PyQt
mailing list