+ fixes #0001689: Show name of the drawing page in the tab of the drawing

This commit is contained in:
wmayer 2014-08-16 15:08:55 +02:00
parent 8808b82371
commit 6556bc776a
4 changed files with 16 additions and 3 deletions

View File

@ -22,6 +22,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QFileInfo>
# include <QIcon>
# include <QImage>
# include <sstream>
@ -61,7 +62,8 @@ open(PyObject *self, PyObject *args)
DrawingView* view = new DrawingView(0, Gui::getMainWindow());
view->load(fileName);
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
view->setWindowTitle(QObject::tr("Drawing viewer"));
QFileInfo fi(fileName);
view->setWindowTitle(fi.fileName());
view->resize( 400, 300 );
Gui::getMainWindow()->addWindow(view);
}
@ -91,7 +93,8 @@ importer(PyObject *self, PyObject *args)
DrawingView* view = new DrawingView(0, Gui::getMainWindow());
view->load(fileName);
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
view->setWindowTitle(QObject::tr("Drawing viewer"));
QFileInfo fi(fileName);
view->setWindowTitle(fi.fileName());
view->resize( 400, 300 );
Gui::getMainWindow()->addWindow(view);
} else {

View File

@ -347,6 +347,15 @@ bool DrawingView::onHasMsg(const char* pMsg) const
return false;
}
void DrawingView::onRelabel(Gui::Document *pDoc)
{
const char* name = pDoc->getDocument()->Label.getValue();
QString title = QString::fromAscii("%1 : %2[*]")
.arg(QString::fromUtf8(name))
.arg(tr("Drawing"));
this->setWindowTitle(title);
}
void DrawingView::printPdf()
{
Gui::FileOptionsDialog dlg(this, 0);

View File

@ -89,6 +89,7 @@ public Q_SLOTS:
public:
bool onMsg(const char* pMsg,const char** ppReturn);
bool onHasMsg(const char* pMsg) const;
void onRelabel(Gui::Document *pDoc);
void print();
void printPdf();
void printPreview();

View File

@ -136,7 +136,7 @@ DrawingView* ViewProviderDrawingPage::showDrawingView()
(this->pcObject->getDocument());
view = new DrawingView(doc, Gui::getMainWindow());
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
view->setWindowTitle(QObject::tr("Drawing viewer") + QString::fromAscii("[*]"));
view->onRelabel(doc);
Gui::getMainWindow()->addWindow(view);
}