Feature Request 1880 - hide Template
This commit is contained in:
parent
12346a67ef
commit
18cd5b5166
|
@ -126,7 +126,6 @@ void QGISVGTemplate::draw()
|
|||
TechDraw::DrawSVGTemplate *tmplte = getSVGTemplate();
|
||||
if(!tmplte)
|
||||
throw Base::Exception("Template Feature not set for QGISVGTemplate");
|
||||
|
||||
load(QString::fromUtf8(tmplte->PageResult.getValue()));
|
||||
}
|
||||
|
||||
|
|
|
@ -471,8 +471,6 @@ QGIView * QGVPage::findParent(QGIView *view) const
|
|||
|
||||
void QGVPage::setPageTemplate(TechDraw::DrawTemplate *obj)
|
||||
{
|
||||
// Remove currently set background template
|
||||
// Assign a base template class and create object dependent on
|
||||
removeTemplate();
|
||||
|
||||
if(obj->isDerivedFrom(TechDraw::DrawParametricTemplate::getClassTypeId())) {
|
||||
|
|
|
@ -37,10 +37,15 @@
|
|||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/SoFCSelection.h>
|
||||
#include <Gui/Selection.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTemplate.h>
|
||||
#include "QGITemplate.h"
|
||||
#include "QGVPage.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "ViewProviderTemplate.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
@ -53,6 +58,7 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderTemplate, Gui::ViewProviderDocumentObje
|
|||
ViewProviderTemplate::ViewProviderTemplate()
|
||||
{
|
||||
sPixmap = "TechDraw_Tree_PageTemplate";
|
||||
DisplayMode.setStatus(App::Property::ReadOnly,true);
|
||||
}
|
||||
|
||||
ViewProviderTemplate::~ViewProviderTemplate()
|
||||
|
@ -84,6 +90,65 @@ void ViewProviderTemplate::updateData(const App::Property* prop)
|
|||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
}
|
||||
|
||||
void ViewProviderTemplate::onChanged(const App::Property *prop)
|
||||
{
|
||||
App::DocumentObject* obj = getObject();
|
||||
if (!obj || obj->isRestoring()) {
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop == &Visibility) {
|
||||
if(Visibility.getValue()) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
}
|
||||
|
||||
void ViewProviderTemplate::show(void)
|
||||
{
|
||||
QGITemplate* qTemplate = getQTemplate();
|
||||
if (qTemplate != nullptr) {
|
||||
qTemplate->show();
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject::show();
|
||||
}
|
||||
|
||||
void ViewProviderTemplate::hide(void)
|
||||
{
|
||||
QGITemplate* qTemplate = getQTemplate();
|
||||
if (qTemplate != nullptr) {
|
||||
qTemplate->hide();
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject::hide();
|
||||
}
|
||||
|
||||
bool ViewProviderTemplate::isShow(void) const
|
||||
{
|
||||
return Visibility.getValue();
|
||||
}
|
||||
|
||||
QGITemplate* ViewProviderTemplate::getQTemplate(void)
|
||||
{
|
||||
QGITemplate *result = nullptr;
|
||||
TechDraw::DrawTemplate* dt = getTemplate();
|
||||
if (dt) {
|
||||
Gui::MDIView* gmdi = getActiveView();
|
||||
if (gmdi != nullptr) {
|
||||
MDIViewPage* mdi = dynamic_cast<MDIViewPage*>(gmdi);
|
||||
if (mdi != nullptr) {
|
||||
result = mdi->getQGVPage()->getTemplate();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
TechDraw::DrawTemplate* ViewProviderTemplate::getTemplate() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawTemplate*>(pcObject);
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace TechDraw{
|
|||
}
|
||||
|
||||
namespace TechDrawGui {
|
||||
class QGITemplate;
|
||||
|
||||
class TechDrawGuiExport ViewProviderTemplate : public Gui::ViewProviderDocumentObject
|
||||
{
|
||||
|
@ -48,8 +49,11 @@ public:
|
|||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
|
||||
public:
|
||||
virtual void onChanged(const App::Property *prop);
|
||||
virtual void hide(void);
|
||||
virtual void show(void);
|
||||
virtual bool isShow(void) const;
|
||||
QGITemplate* getQTemplate(void);
|
||||
TechDraw::DrawTemplate* getTemplate() const;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user