Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, April 2007
Deadlocks with QTreeWidget


Message 1 in thread

Hi,

porting an application to Qt4.2 I encountered the following difficulties:

1) In a QTreeWidget with several columns I want to have only one column 
editable.
However, setting the flag Qt::ItemIsEditable on the QTreeWidgetItem 
makes all columns
editable, and there appears to be no way to restrict this.

2) What also seems to miss is something like setExpandable() in the 
QTreeWidgetItem class
(there was such a function in QListViewItem). This function would allow 
to request data
only when the user expands the tree (which may be huge). A workaround 
might be to
always request data for one depth more than displayed. But it is more 
straightforward
to get the child count as part of the data of an item, and in Qt3 one 
simply called
setExpandable() as a hint to the user.

I know that I might create a special ItemModel class and use QItemView, 
but this
leads to all sorts of complications and additional work not related to 
the problem
to solve.

Thanks,
Richard

--
 [ signature omitted ] 

Message 2 in thread

On 22.04.07 11:47:14, Richard Dengler wrote:
> I know that I might create a special ItemModel class and use QItemView, but 
> this
> leads to all sorts of complications and additional work not related to the 
> problem
> to solve.

Uhm, no. The TreeWidget class is not meant for such advanced usage, so
implementing your own model and using a QTreeView is the right way to
go. Apart from the fact that its not that complicated to create a model
on top of some data in most cases.

Andreas

-- 
 [ signature omitted ]