mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
switched from GxsIdRSTreeWidgetItem to GxsIdItemDelegate, so as to avoid the whole timer system to load ids in Circles list
This commit is contained in:
parent
167380127b
commit
e4dc72169c
@ -170,6 +170,7 @@ 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<RsGroupMetaData>& 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<GxsIdRSTreeWidgetItem*>(item->child(k));
|
||||
subitem = dynamic_cast<RSTreeWidgetItem*>(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<RsGroupMetaData>& 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) ;
|
||||
|
@ -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<QIcon> 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user