add drawing view to the list of document views

This commit is contained in:
wmayer 2012-03-31 14:09:47 +02:00
parent 170ab978fb
commit 3f06cf75ea
5 changed files with 12 additions and 9 deletions

View File

@ -1006,9 +1006,9 @@ MDIView* Document::getActiveView(void) const
}
}
// the active view is not part of this document, just use the first view
// the active view is not part of this document, just use the last view
if (!ok && !mdis.empty())
active = mdis.front();
active = mdis.back();
return active;
}

View File

@ -55,7 +55,7 @@ open(PyObject *self, PyObject *args)
if (file.hasExtension("svg") || file.hasExtension("svgz")) {
QString fileName = QString::fromUtf8(Name);
// Displaying the image in a view
DrawingView* view = new DrawingView(Gui::getMainWindow());
DrawingView* view = new DrawingView(0, Gui::getMainWindow());
view->load(fileName);
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
view->setWindowTitle(QObject::tr("Drawing viewer"));
@ -85,7 +85,7 @@ importer(PyObject *self, PyObject *args)
if (file.hasExtension("svg") || file.hasExtension("svgz")) {
QString fileName = QString::fromUtf8(Name);
// Displaying the image in a view
DrawingView* view = new DrawingView(Gui::getMainWindow());
DrawingView* view = new DrawingView(0, Gui::getMainWindow());
view->load(fileName);
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
view->setWindowTitle(QObject::tr("Drawing viewer"));

View File

@ -200,8 +200,8 @@ void SvgView::wheelEvent(QWheelEvent *event)
/* TRANSLATOR DrawingGui::DrawingView */
DrawingView::DrawingView(QWidget* parent)
: Gui::MDIView(0, parent), m_view(new SvgView)
DrawingView::DrawingView(Gui::Document* doc, QWidget* parent)
: Gui::MDIView(doc, parent), m_view(new SvgView)
{
m_backgroundAction = new QAction(tr("&Background"), this);
m_backgroundAction->setEnabled(false);

View File

@ -79,7 +79,7 @@ class DrawingGuiExport DrawingView : public Gui::MDIView
Q_OBJECT
public:
DrawingView(QWidget* parent = 0);
DrawingView(Gui::Document* doc, QWidget* parent = 0);
public Q_SLOTS:
void load(const QString &path = QString());

View File

@ -40,6 +40,7 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Gui/Application.h>
#include <Gui/SoFCSelection.h>
#include <Gui/Selection.h>
#include <Gui/MainWindow.h>
@ -131,9 +132,11 @@ bool ViewProviderDrawingPage::doubleClicked(void)
DrawingView* ViewProviderDrawingPage::showDrawingView()
{
if (!view){
view = new DrawingView(Gui::getMainWindow());
Gui::Document* doc = Gui::Application::Instance->getDocument
(this->pcObject->getDocument());
view = new DrawingView(doc, Gui::getMainWindow());
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
view->setWindowTitle(QObject::tr("Drawing viewer"));
view->setWindowTitle(QObject::tr("Drawing viewer") + QString::fromAscii("[*]"));
Gui::getMainWindow()->addWindow(view);
}