[TD]fix leader line display attributes

This commit is contained in:
wandererfan
2020-01-13 12:45:48 -05:00
committed by WandererFan
parent c4ca00a1d5
commit d64d6a7c65
4 changed files with 87 additions and 56 deletions

View File

@@ -496,33 +496,30 @@ void QGVPage::addDimToParent(QGIViewDimension* dim, QGIView* parent)
QGIView * QGVPage::addViewLeader(TechDraw::DrawLeaderLine *leader)
{
// Base::Console().Message("QGVP::addViewLeader(%s)\n",leader->getNameInDocument());
QGILeaderLine* leaderGroup = nullptr;
QGILeaderLine* leaderGroup = new QGILeaderLine();
App::DocumentObject* parentObj = leader->LeaderParent.getValue();
TechDraw::DrawView* parentDV = dynamic_cast<TechDraw::DrawView*>(parentObj);
auto ourScene( scene() );
ourScene->addItem(leaderGroup);
//NOTE: if Leaders are ever allowed to not be attached to a View, this next bit will have to change
if (parentDV != nullptr) {
QGIView* parentQV = findQViewForDocObj(parentObj);
if (parentQV != nullptr) {
leaderGroup = new QGILeaderLine(parentQV, leader);
leaderGroup->updateView(true); //this is different from everybody else,
//but it works.
return leaderGroup;
}
} else {
throw Base::TypeError("QGVP::addViewLeader - parent DV has no QGIV");
leaderGroup->setLeaderFeature(leader);
QGIView *parent = 0;
parent = findParent(leaderGroup);
if(parent) {
addLeaderToParent(leaderGroup,parent);
}
return nullptr;
leaderGroup->updateView(true);
return leaderGroup;
}
//assign leader to correct parent if not already so
void QGVPage::addLeaderToParent(QGILeaderLine* lead, QGIView* parent)
{
QGraphicsItem* qgiParent = lead->parentItem();
if (qgiParent != parent) {
parent->addToGroup(lead);
}
// Base::Console().Message("QGVP::addLeaderToParent()\n");
parent->addToGroup(lead);
lead->setZValue(ZVALUE::DIMENSION);
}
QGIView * QGVPage::addRichAnno(TechDraw::DrawRichAnno* anno)