[TD]fix Front lock icon in DPG

This commit is contained in:
wandererfan
2019-10-07 08:06:57 -04:00
committed by WandererFan
parent a276bf46ee
commit 97c17029a6
5 changed files with 28 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ void DrawProjGroupItem::onChanged(const App::Property *prop)
bool DrawProjGroupItem::isLocked(void) const
{
bool isLocked = DrawView::isLocked();
if (isAnchor()) { //Anchor view is always locked to DPG
return true;
}
@@ -112,6 +113,24 @@ bool DrawProjGroupItem::isLocked(void) const
return isLocked;
}
bool DrawProjGroupItem::showLock(void) const
{
bool result = DrawView::showLock();
DrawProjGroup* parent = getPGroup();
bool parentLock = false;
if (parent != nullptr) {
parentLock = parent->LockPosition.getValue();
}
if (isAnchor() && //don't show lock for Front if DPG is not locked
!parentLock) {
result = false;
}
return result;
}
App::DocumentObjectExecReturn *DrawProjGroupItem::execute(void)
{
if (DrawUtil::checkParallel(Direction.getValue(),

View File

@@ -84,6 +84,7 @@ public:
protected:
void onChanged(const App::Property* prop) override;
virtual bool isLocked(void) const override;
virtual bool showLock(void) const override;
private:
static const char* TypeEnums[];

View File

@@ -153,6 +153,11 @@ bool DrawView::isLocked(void) const
return LockPosition.getValue();
}
bool DrawView::showLock(void) const
{
return true;
}
//override this for View inside a group (ex DPGI in DPG)
void DrawView::handleXYLock(void)
{

View File

@@ -92,6 +92,7 @@ public:
void requestPaint(void);
virtual void handleXYLock(void);
virtual bool isLocked(void) const;
virtual bool showLock(void) const;
std::vector<TechDraw::DrawLeaderLine*> getLeaders(void) const;

View File

@@ -502,7 +502,8 @@ void QGIView::drawBorder()
double lockX = frameArea.left();
double lockY = frameArea.bottom() - m_lockHeight;
if (feat->isLocked()) {
if (feat->isLocked() &&
feat->showLock()) {
m_lock->setZValue(ZVALUE::LOCK);
m_lock->setPos(lockX,lockY);
m_lock->show();