mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 00:07:09 -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);
|
contactsItem->setData(RSID_COL_VOTES, Qt::DecorationRole,0xff);
|
||||||
|
|
||||||
ui->treeWidget_membership->clear();
|
ui->treeWidget_membership->clear();
|
||||||
|
ui->treeWidget_membership->setItemDelegateForColumn(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,new GxsIdTreeItemDelegate());
|
||||||
|
|
||||||
mExternalOtherCircleItem = NULL ;
|
mExternalOtherCircleItem = NULL ;
|
||||||
mExternalBelongingCircleItem = NULL ;
|
mExternalBelongingCircleItem = NULL ;
|
||||||
@ -768,13 +769,13 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
|||||||
#ifdef ID_DEBUG
|
#ifdef ID_DEBUG
|
||||||
std::cerr << "invited: " << invited << ", subscription: " << subscrb ;
|
std::cerr << "invited: " << invited << ", subscription: " << subscrb ;
|
||||||
#endif
|
#endif
|
||||||
GxsIdRSTreeWidgetItem *subitem = NULL ;
|
RSTreeWidgetItem *subitem = NULL ;
|
||||||
|
|
||||||
// see if the item already exists
|
// see if the item already exists
|
||||||
for(uint32_t k=0; k < (uint32_t)item->childCount(); ++k)
|
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())
|
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
|
#ifdef ID_DEBUG
|
||||||
std::cerr << " found existing sub item." << std::endl;
|
std::cerr << " found existing sub item." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -803,9 +804,8 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
|||||||
#ifdef ID_DEBUG
|
#ifdef ID_DEBUG
|
||||||
std::cerr << " no existing sub item. Creating new one." << std::endl;
|
std::cerr << " no existing sub item. Creating new one." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
subitem = new GxsIdRSTreeWidgetItem(NULL,GxsIdDetails::ICON_TYPE_AVATAR,false);
|
subitem = new RSTreeWidgetItem(NULL);
|
||||||
|
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,Qt::UserRole,QString::fromStdString(it->first.toStdString()));
|
||||||
subitem->setId(it->first,CIRCLEGROUP_CIRCLE_COL_GROUPNAME,true);
|
|
||||||
|
|
||||||
RsIdentityDetails idd ;
|
RsIdentityDetails idd ;
|
||||||
bool has_id = rsIdentity->getIdDetails(it->first,idd) ;
|
bool has_id = rsIdentity->getIdDetails(it->first,idd) ;
|
||||||
|
@ -90,14 +90,17 @@ public:
|
|||||||
|
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
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;
|
QStyleOptionViewItemV4 opt = option;
|
||||||
initStyleOption(&opt, index);
|
initStyleOption(&opt, index);
|
||||||
|
|
||||||
// disable default icon
|
// disable default icon
|
||||||
opt.icon = QIcon();
|
opt.icon = QIcon();
|
||||||
const QRect r = option.rect;
|
const QRect r = option.rect;
|
||||||
|
|
||||||
RsGxsId id(index.data(Qt::UserRole).toString().toStdString());
|
|
||||||
QString str;
|
QString str;
|
||||||
QList<QIcon> icons;
|
QList<QIcon> icons;
|
||||||
QString comment;
|
QString comment;
|
||||||
@ -128,6 +131,11 @@ public:
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsGxsId id(index.data(Qt::UserRole).toString().toStdString());
|
||||||
|
|
||||||
|
if(id.isNull())
|
||||||
|
return QStyledItemDelegate::paint(painter,option,index);
|
||||||
|
|
||||||
QStyleOptionViewItemV4 opt = option;
|
QStyleOptionViewItemV4 opt = option;
|
||||||
initStyleOption(&opt, index);
|
initStyleOption(&opt, index);
|
||||||
|
|
||||||
@ -138,7 +146,6 @@ public:
|
|||||||
|
|
||||||
const QRect r = option.rect;
|
const QRect r = option.rect;
|
||||||
|
|
||||||
RsGxsId id(index.data(Qt::UserRole).toString().toStdString());
|
|
||||||
QString str;
|
QString str;
|
||||||
QString comment;
|
QString comment;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user