[TD]fix LeaderLine noshow on doc load
This commit is contained in:
@@ -161,8 +161,16 @@ MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget*
|
||||
App::Document* appDoc = m_vpPage->getDocument()->getDocument();
|
||||
auto bnd = boost::bind(&MDIViewPage::onDeleteObject, this, _1);
|
||||
connectDeletedObject = appDoc->signalDeletedObject.connect(bnd);
|
||||
}
|
||||
|
||||
|
||||
MDIViewPage::~MDIViewPage()
|
||||
{
|
||||
connectDeletedObject.disconnect();
|
||||
}
|
||||
|
||||
void MDIViewPage::addChildrenToPage(void)
|
||||
{
|
||||
// A fresh page is added and we iterate through its collected children and add these to Canvas View -MLP
|
||||
// if docobj is a featureviewcollection (ex orthogroup), add its child views. if there are ever children that have children,
|
||||
// we'll have to make this recursive. -WF
|
||||
@@ -190,12 +198,8 @@ MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget*
|
||||
attachTemplate(pageTemplate);
|
||||
matchSceneRectToTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MDIViewPage::~MDIViewPage()
|
||||
{
|
||||
connectDeletedObject.disconnect();
|
||||
viewAll();
|
||||
}
|
||||
|
||||
void MDIViewPage::matchSceneRectToTemplate(void)
|
||||
@@ -246,10 +250,13 @@ void MDIViewPage::setBalloonGroups(void)
|
||||
|
||||
void MDIViewPage::setLeaderGroups(void)
|
||||
{
|
||||
// Base::Console().Message("MDIVP::setLeaderGroups()\n");
|
||||
const std::vector<QGIView *> &allItems = m_view->getViews();
|
||||
std::vector<QGIView *>::const_iterator itInspect;
|
||||
int leadItemType = QGraphicsItem::UserType + 232;
|
||||
|
||||
//make sure that qgileader belongs to correct parent.
|
||||
//quite possibly redundant
|
||||
for (itInspect = allItems.begin(); itInspect != allItems.end(); itInspect++) {
|
||||
if (((*itInspect)->type() == leadItemType) && (!(*itInspect)->group())) {
|
||||
QGIView* parent = m_view->findParent((*itInspect));
|
||||
@@ -400,7 +407,7 @@ void MDIViewPage::onDeleteObject(const App::DocumentObject& obj)
|
||||
}
|
||||
|
||||
void MDIViewPage::onTimer() {
|
||||
updateDrawing(true);
|
||||
fixOrphans(true);
|
||||
}
|
||||
|
||||
void MDIViewPage::updateTemplate(bool forceUpdate)
|
||||
@@ -430,9 +437,7 @@ void MDIViewPage::updateTemplate(bool forceUpdate)
|
||||
}
|
||||
|
||||
//this is time consuming. should only be used when there is a problem.
|
||||
//should have been called MDIViewPage::fixWidowAndOrphans()
|
||||
//void MDIViewPage::updateDrawing(bool forceUpdate)
|
||||
void MDIViewPage::updateDrawing(bool force)
|
||||
void MDIViewPage::fixOrphans(bool force)
|
||||
{
|
||||
if(!force) {
|
||||
m_timer->start(100);
|
||||
@@ -479,7 +484,7 @@ void MDIViewPage::updateDrawing(bool force)
|
||||
// WF: why do we do this? views should be keeping themselves up to date.
|
||||
// const std::vector<QGIView *> &upviews = m_view->getViews();
|
||||
// for(std::vector<QGIView *>::const_iterator it = upviews.begin(); it != upviews.end(); ++it) {
|
||||
// Base::Console().Message("TRACE - MDIVP::updateDrawing - updating a QGIVxxxx\n");
|
||||
// Base::Console().Message("TRACE - MDIVP::fixOrphans - updating a QGIVxxxx\n");
|
||||
// if((*it)->getViewObject()->isTouched() ||
|
||||
// forceUpdate) {
|
||||
// (*it)->updateView(forceUpdate);
|
||||
@@ -487,7 +492,7 @@ void MDIViewPage::updateDrawing(bool force)
|
||||
// }
|
||||
}
|
||||
|
||||
//NOTE: this doesn't add missing views. see updateDrawing()
|
||||
//NOTE: this doesn't add missing views. see fixOrphans()
|
||||
void MDIViewPage::redrawAllViews()
|
||||
{
|
||||
const std::vector<QGIView *> &upviews = m_view->getViews();
|
||||
@@ -496,7 +501,7 @@ void MDIViewPage::redrawAllViews()
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE: this doesn't add missing views. see updateDrawing()
|
||||
//NOTE: this doesn't add missing views. see fixOrphans()
|
||||
void MDIViewPage::redraw1View(TechDraw::DrawView* dv)
|
||||
{
|
||||
std::string dvName = dv->getNameInDocument();
|
||||
|
||||
@@ -57,6 +57,9 @@ public:
|
||||
MDIViewPage(ViewProviderPage *page, Gui::Document* doc, QWidget* parent = 0);
|
||||
virtual ~MDIViewPage();
|
||||
|
||||
void addChildrenToPage(void);
|
||||
|
||||
|
||||
/// Observer message from the Tree Selection mechanism
|
||||
void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void preSelectionChanged(const QPoint &pos);
|
||||
@@ -68,7 +71,7 @@ public:
|
||||
|
||||
void attachTemplate(TechDraw::DrawTemplate *obj);
|
||||
void updateTemplate(bool force = false);
|
||||
void updateDrawing(bool force = false);
|
||||
void fixOrphans(bool force = false);
|
||||
void matchSceneRectToTemplate(void);
|
||||
|
||||
bool onMsg(const char* pMsg,const char** ppReturn);
|
||||
|
||||
@@ -132,6 +132,7 @@ QGILeaderLine::QGILeaderLine(QGraphicsItem* myParent,
|
||||
m_editPath, SIGNAL(pointsUpdated(QPointF, std::vector<QPointF>)),
|
||||
this , SLOT (onLineEditFinished(QPointF, std::vector<QPointF>))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
QVariant QGILeaderLine::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
@@ -358,18 +359,13 @@ void QGILeaderLine::draw()
|
||||
return;
|
||||
}
|
||||
TechDraw::DrawView* parent = featLeader->getBaseView();
|
||||
QGVPage* view = QGIView::getGraphicsView(parent);
|
||||
if (view == nullptr) {
|
||||
// Base::Console().Message("QGIL::draw - no graphcisView for parent!! - setup?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_editPath->inEdit()) {
|
||||
// Base::Console().Message("QGIL::draw - m_editPath in edit\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//********
|
||||
|
||||
if (featLeader->isLocked()) {
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
} else {
|
||||
@@ -453,6 +449,7 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
||||
|
||||
QPointF QGILeaderLine::getAttachFromFeature(void)
|
||||
{
|
||||
// Base::Console().Message("QGILL::getAttachFromFeature()\n");
|
||||
QPointF result;
|
||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||
if((!featLeader) ) {
|
||||
|
||||
@@ -516,15 +516,13 @@ QGIView * QGVPage::addViewLeader(TechDraw::DrawLeaderLine *leader)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//assign leader to correct parent if not already so
|
||||
void QGVPage::addLeaderToParent(QGILeaderLine* lead, QGIView* parent)
|
||||
{
|
||||
assert(lead);
|
||||
assert(parent); //blow up if we don't have Leader or Parent
|
||||
QPointF posRef(0.,0.);
|
||||
QPointF mapPos = lead->mapToItem(parent, posRef);
|
||||
lead->moveBy(-mapPos.x(), -mapPos.y());
|
||||
parent->addToGroup(lead); //vs lead->setParentItem(parent)??
|
||||
lead->setZValue(ZVALUE::DIMENSION);
|
||||
QGraphicsItem* qgiParent = lead->parentItem();
|
||||
if (qgiParent != parent) {
|
||||
parent->addToGroup(lead);
|
||||
}
|
||||
}
|
||||
|
||||
QGIView * QGVPage::addRichAnno(TechDraw::DrawRichAnno* anno)
|
||||
@@ -610,7 +608,7 @@ QGIView* QGVPage::getQGIVByName(std::string name)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//find the parent of a QGIV based on the corresponding feature's parentage
|
||||
QGIView * QGVPage::findParent(QGIView *view) const
|
||||
{
|
||||
const std::vector<QGIView *> qviews = getViews();
|
||||
|
||||
@@ -185,7 +185,7 @@ void ViewProviderPage::updateData(const App::Property* prop)
|
||||
}
|
||||
} else if (prop == &page->Views) {
|
||||
if(m_mdiView && !page->isUnsetting())
|
||||
m_mdiView->updateDrawing();
|
||||
m_mdiView->fixOrphans();
|
||||
}
|
||||
|
||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
@@ -247,7 +247,6 @@ bool ViewProviderPage::showMDIViewPage()
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument
|
||||
(pcObject->getDocument());
|
||||
m_mdiView = new MDIViewPage(this, doc, Gui::getMainWindow());
|
||||
// QString tabTitle = QString::fromUtf8(getDrawPage()->getNameInDocument());
|
||||
QString tabTitle = QString::fromUtf8(getDrawPage()->Label.getValue());
|
||||
|
||||
m_mdiView->setDocumentObject(getDrawPage()->getNameInDocument());
|
||||
@@ -255,16 +254,15 @@ bool ViewProviderPage::showMDIViewPage()
|
||||
|
||||
m_mdiView->setWindowTitle(tabTitle + QString::fromLatin1("[*]"));
|
||||
m_mdiView->setWindowIcon(Gui::BitmapFactory().pixmap("TechDraw_Tree_Page"));
|
||||
m_mdiView->updateDrawing(true);
|
||||
Gui::getMainWindow()->addWindow(m_mdiView);
|
||||
m_mdiView->viewAll(); //this is empty function
|
||||
m_mdiView->viewAll();
|
||||
m_mdiView->showMaximized();
|
||||
// if(!getDrawPage()->KeepUpdated.getValue())
|
||||
// getDrawPage()->KeepUpdated.setValue(true);
|
||||
m_mdiView->addChildrenToPage();
|
||||
m_mdiView->fixOrphans(true);
|
||||
} else {
|
||||
m_mdiView->updateDrawing(true);
|
||||
m_mdiView->redrawAllViews();
|
||||
m_mdiView->updateTemplate(true);
|
||||
m_mdiView->redrawAllViews();
|
||||
m_mdiView->fixOrphans(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -429,7 +427,7 @@ void ViewProviderPage::onGuiRepaint(const TechDraw::DrawPage* dp)
|
||||
if (dp == getDrawPage()) {
|
||||
if(!m_mdiView.isNull() &&
|
||||
!getDrawPage()->isUnsetting()) {
|
||||
m_mdiView->updateDrawing();
|
||||
m_mdiView->fixOrphans();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user