Qt-interest Archive, July 2007
QTreeView wrong editor placement
Message 1 in thread
Hi,
i have code that is triggered from a menu item and adds a new item into
an ItemViewModel that is displayed in a QTreeView.
After adding the item to the model it signals renameBookmark to the
QTreeView to automatically start editing (just a string) the new item.
The slot code in the QTreeView looks like this:
void BookmarkView::renameBookmark( Bookmark* bm )
{
QModelIndex index = _itemModel->index(bm);
setCurrentIndex(index);
scrollTo(index);
edit(index);
}
Basically it works except the editor positioning. If i manually start
editing by double clicking an item, the editor is placed properly above
the text, right to the decoration pixmap.
If the edit is started by the code above, the editor is placed above the
text but also above the decoration pixmap. The decoration is not visible
and the text below the editor is visible on the right, ie. the editor is
placed to much left.
Any idea what's wrong here?
Martin
--
[ signature omitted ]