Qt-interest Archive, February 2007
Selecting text from QTreeView or QTableView
Message 1 in thread
Greetings?
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 a
QTextEdit. I do not need to select from multiple cells, but I may
have many rows. Creating a widget for every cell may be too
expensive.
Any ideas on how this can be done?
--
[ signature omitted ]
Message 2 in thread
"Kelly Burkhart" <kelly.burkhart@xxxxxxxxx> wrote in message
news:fa1e4ce70702030839q26568b26r48c4f8acd9efba60@xxxxxxxxxxxxxxxxx
> Greetings?
>
> 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 a
> QTextEdit. I do not need to select from multiple cells, but I may
> have many rows. Creating a widget for every cell may be too
> expensive.
>
> Any ideas on how this can be done?
What are you using for items? QTreeWidgetItem
has a function text(int column) that returns a QString.
I'm not sure about the views as I usually use either
QTreeWidget or QTableWidget.
--
[ signature omitted ]
Message 3 in thread
I think you could use 2 aproaches.
First - get cell into an editing state, this way you will be able to select
text since it is QLineEdit.
Harder way is to write you own delegate, track mouse drag and paint
selection.
Yuriy
----- Original Message -----
From: "Kelly Burkhart" <kelly.burkhart@xxxxxxxxx>
To: <qt-interest@xxxxxxxxxxxxx>
Sent: Saturday, February 03, 2007 6:39 PM
Subject: Selecting text from QTreeView or QTableView
> Greetings?
>
> 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 a
> QTextEdit. I do not need to select from multiple cells, but I may
> have many rows. Creating a widget for every cell may be too
> expensive.
>
> Any ideas on how this can be done?
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]