Error with icon in delegate
-
Hello!
I have successor of QStyledItemDelegate which consist of button with icon(iconPushButton) and other widgets.
Every item(QStandardIem) in my model has icon too and when i create delegate i do so that the icon in the widget was the same as that of the item. And when user close delegate everything should happen contrary.
1 opeartion duct right, but if i try to set icon of item from delegate widget returns the icon that was in of the item before the call to the delegate.
I try to set icon of item with this code:
@void RDataTreeViewItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
RDataTreeViewItemWidget itemWidget = static_cast<RDataTreeViewItemWidget>(editor);
QStandardItemModel *mod = static_cast<QStandardItemModel *>(model);
QStandardItem *item = static_cast<QStandardItem *>(mod->itemFromIndex(index));mod->setData(index, itemWidget->getText(), Qt::EditRole); //This operation duct right item->setIcon(itemWidget->iconPushButton->icon()); //But this not
}@
Icon of iconPushButton and icon of item is different.
How can i solve this problem? -
I know english bad, and i try to present a picture that i want
!http://s1.hostingkartinok.com/uploads/images/2012/05/a85cb2d1c7f3b2a8efb27963fd981cfd.png(1)!
The code remains the same -
Is it a bug in Qt or my fault?