Attacher: display modes that can be reached
Attachment mode list used to display only the modes that fit current references. Now, modes that can be reached by adding more references are listed too, but grayed out.
This commit is contained in:
@@ -675,9 +675,16 @@ void TaskDatumParameters::updateListOfModes(eMapMode curMode)
|
||||
//obtain list of available modes:
|
||||
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
|
||||
eMapMode suggMode = mmDeactivated;
|
||||
std::set<eMapMode> reachableModes;
|
||||
int lastValidModeItemIndex = mmDummy_NumberOfModes;
|
||||
if (pcDatum->Support.getSize() > 0){
|
||||
eSuggestResult msg;
|
||||
suggMode = pcDatum->attacher().listMapModes(msg, &modesInList);
|
||||
suggMode = pcDatum->attacher().listMapModes(msg, &modesInList, 0, &reachableModes);
|
||||
//add reachable modes to the list, too, but gray them out (using lastValidModeItemIndex, later)
|
||||
lastValidModeItemIndex = modesInList.size()-1;
|
||||
for(eMapMode m: reachableModes){
|
||||
modesInList.push_back(m);
|
||||
}
|
||||
} else {
|
||||
//no references - display all modes
|
||||
modesInList.clear();
|
||||
@@ -702,13 +709,17 @@ void TaskDatumParameters::updateListOfModes(eMapMode curMode)
|
||||
AttacherGui::getRefListForMode(pcDatum->attacher(),mmode).join(QString::fromLatin1("\n")));
|
||||
if (mmode == curMode)
|
||||
iSelect = ui->listOfModes->item(i);
|
||||
if (mmode == suggMode){
|
||||
//make it bold
|
||||
if (i > lastValidModeItemIndex){
|
||||
//potential mode - can be reached by selecting more stuff
|
||||
item->setFlags(item->flags() & ~(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsSelectable));
|
||||
} else if (mmode == suggMode){
|
||||
//suggested mode - make bold
|
||||
assert (item);
|
||||
QFont fnt = item->font();
|
||||
fnt.setBold(true);
|
||||
item->setFont(fnt);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//restore selection
|
||||
|
||||
Reference in New Issue
Block a user