Skip to content

Commit

Permalink
Attacher: list ref. combinations in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSOIC committed Apr 21, 2016
1 parent 7e14a04 commit 4a1a148
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/Mod/Part/Gui/AttacherTexts.cpp
Expand Up @@ -342,4 +342,18 @@ QString getShapeTypeText(eRefType type)
throw Base::Exception("getShTypeText: type value is wrong, or a string is missing in the list");
}

QStringList getRefListForMode(AttachEngine &attacher, eMapMode mmode)
{
AttachEngine::refTypeStringList list = attacher.modeRefTypes[mmode];
QStringList strlist;
for(AttachEngine::refTypeString &rts : list){
QStringList buf;
for(eRefType rt : rts){
buf.append(getShapeTypeText(rt));
}
strlist.append(buf.join(QString::fromLatin1(", ")));
}
return strlist;
}

} //namespace AttacherGui
3 changes: 3 additions & 0 deletions src/Mod/Part/Gui/AttacherTexts.h
Expand Up @@ -32,6 +32,7 @@

#include <vector>
#include <QString>
#include <QStringList>
#include <Mod/Part/App/Attacher.h>

namespace AttacherGui {
Expand All @@ -51,6 +52,8 @@ TextSet PartGuiExport getUIStrings(Base::Type attacherType, Attacher::eMapMode m

QString PartGuiExport getShapeTypeText(Attacher::eRefType type);

QStringList PartGuiExport getRefListForMode(Attacher::AttachEngine &attacher, Attacher::eMapMode mmode);

}

#endif
4 changes: 3 additions & 1 deletion src/Mod/PartDesign/Gui/TaskDatumParameters.cpp
Expand Up @@ -658,7 +658,9 @@ void TaskDatumParameters::updateListOfModes(eMapMode curMode)
std::vector<QString> mstr = AttacherGui::getUIStrings(pcDatum->attacher().getTypeId(),mmode);
ui->listOfModes->addItem(mstr[0]);
QListWidgetItem* item = ui->listOfModes->item(i);
item->setToolTip(mstr[1]);
item->setToolTip(mstr[1] + QString::fromLatin1("\n\n") +
tr("Reference combinations:\n") +
AttacherGui::getRefListForMode(pcDatum->attacher(),mmode).join(QString::fromLatin1("\n")));
if (mmode == curMode)
iSelect = ui->listOfModes->item(i);
if (mmode == suggMode){
Expand Down

0 comments on commit 4a1a148

Please sign in to comment.