qt-interest@trolltech.com
[Top] [All Lists]

model/view problems

Subject: model/view problems
From: Ole Morten Grodsås
Date: Thu, 21 Jul 2005 17:01:53 +0200
Hi,

I'm having some "newbie" problems with the model/view programming. I
have been searching around for a solution for some time but can't find
one. 

Case:
I have created a model by sub classing QAbstractItemModel. I'm using
QTreeView to display the model.


Problem 1:
I want to  edit the items in the QTreeView. As fare as I know the
QTreeView has a default delegate. I'm playing around with variations of
the following code:

treeView->setModel(model);
treeView->setSelectionBehavior (QAbstractItemView::SelectItems);
treeView->setEditTriggers(QAbstractItemView::DoubleClicked);    

but nothing is working.

Problem 2:
I have another QTreeView (using the same model). Here I want the
QTreeView to display checkboxes. 

The only clue I have is that the QTreeWidgetItem has a setFlags function
where one of the flags are Qt::ItemIsUserCheckable. I have not found
anything similar in the model/view classes.  

A explanation of what I doing wrong or a pointer to where I can find a
example would be of great help.
 
Thanks in advance.

-- 
Ole Morten GrodÃs

<Prev in Thread] Current Thread [Next in Thread>