[PyKDE] QTreeView -- selecting text within cell
david at boddie.org.uk
Sat Feb 3 17:52:38 GMT 2007
On Friday 02 February 2007 12:12:24 -0600, Kelly Burkhart 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.
This sounds simple, but I suspect it is not.
> Any ideas on how this can be done?
Make the items/cells editable, so that you can select text using a
standard editor widget. If you don't want to actually allow editing to
occur, you'll need to create your own QItemDelegate that doesn't write
changes back to the model.
There may be other ways to do this, but the only ones I can think of
are fairly complex, requiring you to implement a delegate to actually
paint the text yourself. I was hoping that someone else might have a
bright idea when I saw your previous message.
More information about the PyQt