+ fixes #0001698: All drawing pages are opened automatically when opening a project file

This commit is contained in:
wmayer
2015-01-03 13:45:12 +01:00
parent c1de7e3f3d
commit 7ff61a13f5
4 changed files with 70 additions and 11 deletions

View File

@@ -58,7 +58,9 @@
#include <Base/Stream.h>
#include <Base/gzstream.h>
#include <Base/PyObjectBase.h>
#include <App/Document.h>
#include <Gui/Document.h>
#include <Gui/ViewProvider.h>
#include <Gui/FileDialog.h>
#include <Gui/WaitCursor.h>
@@ -249,6 +251,10 @@ DrawingView::DrawingView(Gui::Document* doc, QWidget* parent)
//setWindowTitle(tr("SVG Viewer"));
}
DrawingView::~DrawingView()
{
}
void DrawingView::load (const QString & fileName)
{
if (!fileName.isEmpty()) {
@@ -274,6 +280,27 @@ void DrawingView::load (const QString & fileName)
}
}
void DrawingView::setDocumentObject(const std::string& name)
{
m_objectName = name;
}
void DrawingView::closeEvent(QCloseEvent* ev)
{
ev->accept();
// when closing the view from GUI notify the view provider to mark it invisible
if (_pcDocument && !m_objectName.empty()) {
App::Document* doc = _pcDocument->getDocument();
if (doc) {
App::DocumentObject* obj = doc->getObject(m_objectName.c_str());
Gui::ViewProvider* vp = _pcDocument->getViewProvider(obj);
if (vp)
vp->hide();
}
}
}
void DrawingView::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu;