Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error with icon in delegate
Forum Updated to NodeBB v4.3 + New Features

Error with icon in delegate

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ruzik
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Ruzik
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Ruzik
        wrote on last edited by
        #3

        Is it a bug in Qt or my fault?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved