KeepLabel Property to Gui side

This commit is contained in:
WandererFan
2018-02-13 14:51:58 -05:00
parent 2ec68ac393
commit 6fa92cb188
5 changed files with 15 additions and 6 deletions

View File

@@ -84,9 +84,7 @@ DrawView::DrawView(void)
ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view");
Scale.setConstraints(&scaleRange);
ADD_PROPERTY_TYPE(KeepLabel ,(false),fgroup,App::Prop_None,"Keep Label on Page even if toggled off");
ADD_PROPERTY_TYPE(Caption ,(""),fgroup,App::Prop_None,"Short text about the view");
}
DrawView::~DrawView()

View File

@@ -55,7 +55,6 @@ public:
App::PropertyEnumeration ScaleType;
App::PropertyFloat Rotation;
App::PropertyBool KeepLabel;
App::PropertyString Caption;
/** @name methods override Feature */

View File

@@ -59,6 +59,7 @@
#include "QGICaption.h"
#include "QGCustomClip.h"
#include "QGIViewClip.h"
#include "ViewProviderDrawingView.h"
#include <Mod/TechDraw/App/DrawViewClip.h>
#include <Mod/TechDraw/App/DrawProjGroup.h>
@@ -354,7 +355,8 @@ void QGIView::drawCaption()
QPointF displayCenter = displayArea.center();
m_caption->setX(displayCenter.x() - captionArea.width()/2.);
double labelHeight = (1 - labelCaptionFudge) * m_label->boundingRect().height();
if (borderVisible || viewObj->KeepLabel.getValue()) { //place below label if label visible
auto vp = static_cast<ViewProviderDrawingView*>(getViewProvider(getViewObject()));
if (borderVisible || vp->KeepLabel.getValue()) { //place below label if label visible
m_caption->setY(displayArea.bottom() + labelHeight);
} else {
m_caption->setY(displayArea.bottom() + labelCaptionFudge * getPrefFontSize());
@@ -366,7 +368,8 @@ void QGIView::drawBorder()
{
drawCaption();
//show neither
if (!borderVisible && !viewObj->KeepLabel.getValue()) {
auto vp = static_cast<ViewProviderDrawingView*>(getViewProvider(getViewObject()));
if (!borderVisible && !vp->KeepLabel.getValue()) {
m_label->hide();
m_border->hide();
return;

View File

@@ -61,11 +61,13 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderDrawingView, Gui::ViewProviderDocumentO
ViewProviderDrawingView::ViewProviderDrawingView()
{
sPixmap = "TechDraw_Tree_View";
static const char *group = "Base";
ADD_PROPERTY_TYPE(KeepLabel ,(false),group,App::Prop_None,"Keep Label on Page even if toggled off");
// Do not show in property editor why? wf
DisplayMode.setStatus(App::Property::ReadOnly,true);
m_docReady = true;
}
ViewProviderDrawingView::~ViewProviderDrawingView()
@@ -110,7 +112,13 @@ void ViewProviderDrawingView::onChanged(const App::Property *prop)
} else {
hide();
}
} else if (prop == &KeepLabel) {
QGIView* qgiv = getQView();
if (qgiv) {
qgiv->updateView(true);
}
}
Gui::ViewProviderDocumentObject::onChanged(prop);
}

View File

@@ -49,6 +49,7 @@ public:
/// destructor
virtual ~ViewProviderDrawingView();
App::PropertyBool KeepLabel;
virtual void attach(App::DocumentObject *);
virtual void setDisplayMode(const char* ModeName);