PDA

View Full Version : little problem with QStyledItemDelegate



Qiieha
22nd November 2012, 08:06
Hi guys,
I subclassed QTreeView, QAbstractItemModel and QStyledItemDelegate. I have different editors for different datatypes and set AllEditTriggers. Now there are two problems.


If I navigate through the Indexes, there is opened just every second editor, although the method createEditor is called and an editor is returned...: (
The second problem is that there is for example a QTextEdit- editor. When the editor is opened there should be the textcursor in the QTextEdit. I tried lots of different variants (focusPolicy, setFocus, movePosition of cursor, etc. ...), nothing solves the problem.



Maybe someone can help me...

thanks

Qiieha
26th November 2012, 09:21
I solved the problems now...

The big clue was the focus settings of the widgets. setFocusPolicy, setFocusProxy and setFocus in constructor or setEditorData method solve the problems...;)