fixed bug in circle chooser that showed duplicates. Removed mCircleExternalIdList (not really useful now that circles are cached) and used a std::set to ensure uniqueness

This commit is contained in:
csoler 2020-12-05 20:12:03 +01:00
parent af76cf028c
commit dbd6477acd
4 changed files with 12 additions and 140 deletions

View file

@ -63,7 +63,7 @@ bool MakeGxsCircleDesc(const RsGxsCircleId &id, QString &desc)
void GxsCircleChooser::loadGxsCircles()
{
std::list<RsGxsCircleId> ids;
std::set<RsGxsCircleId> ids;
rsGxsCircles->getCircleExternalIdList(ids);
if (ids.empty())
@ -73,10 +73,9 @@ void GxsCircleChooser::loadGxsCircles()
return;
}
std::list<RsGxsCircleId>::iterator it;
int i = 0;
int def = -1;
for(it = ids.begin(); it != ids.end(); ++it, ++i)
for(auto it(ids.begin()); it != ids.end(); ++it, ++i)
{
/* add to Chooser */
QString str;
@ -91,15 +90,11 @@ void GxsCircleChooser::loadGxsCircles()
addItem(str, id);
if (mDefaultCircleId == *it)
{
def = i;
}
}
if (def >= 0)
{
setCurrentIndex(def);
}
}
bool GxsCircleChooser::getChosenCircle(RsGxsCircleId &id)