diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index f77fd2e19..4a4ec6530 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -170,7 +170,8 @@ IdDialog::IdDialog(QWidget *parent) : MainPage(parent), ui(new Ui::IdDialog) contactsItem->setData(RSID_COL_VOTES, Qt::DecorationRole,0xff); ui->treeWidget_membership->clear(); - + ui->treeWidget_membership->setItemDelegateForColumn(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,new GxsIdTreeItemDelegate()); + mExternalOtherCircleItem = NULL ; mExternalBelongingCircleItem = NULL ; @@ -768,13 +769,13 @@ void IdDialog::loadCircles(const std::list& groupInfo) #ifdef ID_DEBUG std::cerr << "invited: " << invited << ", subscription: " << subscrb ; #endif - GxsIdRSTreeWidgetItem *subitem = NULL ; + RSTreeWidgetItem *subitem = NULL ; // see if the item already exists for(uint32_t k=0; k < (uint32_t)item->childCount(); ++k) if(item->child(k)->data(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole).toString().toStdString() == it->first.toStdString()) { - subitem = dynamic_cast(item->child(k)); + subitem = dynamic_cast(item->child(k)); #ifdef ID_DEBUG std::cerr << " found existing sub item." << std::endl; #endif @@ -803,9 +804,8 @@ void IdDialog::loadCircles(const std::list& groupInfo) #ifdef ID_DEBUG std::cerr << " no existing sub item. Creating new one." << std::endl; #endif - subitem = new GxsIdRSTreeWidgetItem(NULL,GxsIdDetails::ICON_TYPE_AVATAR,false); - - subitem->setId(it->first,CIRCLEGROUP_CIRCLE_COL_GROUPNAME,true); + subitem = new RSTreeWidgetItem(NULL); + subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,Qt::UserRole,QString::fromStdString(it->first.toStdString())); RsIdentityDetails idd ; bool has_id = rsIdentity->getIdDetails(it->first,idd) ; diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h index 85c4de40f..8e7cccb3f 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.h @@ -90,14 +90,17 @@ public: QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override { + RsGxsId id(index.data(Qt::UserRole).toString().toStdString()); + + if(id.isNull()) + return QStyledItemDelegate::sizeHint(option,index); + QStyleOptionViewItemV4 opt = option; initStyleOption(&opt, index); // disable default icon opt.icon = QIcon(); const QRect r = option.rect; - - RsGxsId id(index.data(Qt::UserRole).toString().toStdString()); QString str; QList icons; QString comment; @@ -128,6 +131,11 @@ public: return ; } + RsGxsId id(index.data(Qt::UserRole).toString().toStdString()); + + if(id.isNull()) + return QStyledItemDelegate::paint(painter,option,index); + QStyleOptionViewItemV4 opt = option; initStyleOption(&opt, index); @@ -138,7 +146,6 @@ public: const QRect r = option.rect; - RsGxsId id(index.data(Qt::UserRole).toString().toStdString()); QString str; QString comment;