+ fixes #0001689: Show name of the drawing page in the tab of the drawing
This commit is contained in:
parent
8943ef58b2
commit
7110c55c33
|
@ -349,11 +349,22 @@ bool DrawingView::onHasMsg(const char* pMsg) const
|
|||
|
||||
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);
|
||||
if (!bIsPassive) {
|
||||
// Try to separate document name and object name if there is one
|
||||
QString cap = windowTitle();
|
||||
QRegExp rx(QString::fromLatin1(" : (\\w|\\s){1,}(\\[\\*\\]){0,1}$"));
|
||||
int pos = rx.lastIndexIn(cap);
|
||||
if (pos != -1) {
|
||||
cap = QString::fromUtf8(pDoc->getDocument()->Label.getValue());
|
||||
cap += rx.cap();
|
||||
setWindowTitle(cap);
|
||||
}
|
||||
else {
|
||||
cap = QString::fromUtf8(pDoc->getDocument()->Label.getValue());
|
||||
cap = QString::fromAscii("%1[*]").arg(cap);
|
||||
setWindowTitle(cap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawingView::printPdf()
|
||||
|
|
|
@ -104,6 +104,16 @@ void ViewProviderDrawingPage::updateData(const App::Property* prop)
|
|||
view->viewAll();
|
||||
}
|
||||
}
|
||||
else if (pcObject && prop == &pcObject->Label) {
|
||||
if (view){
|
||||
const char* docname = pcObject->getDocument()->Label.getValue();
|
||||
const char* objname = pcObject->Label.getValue();
|
||||
QString title = QString::fromAscii("%1 : %2[*]")
|
||||
.arg(QString::fromUtf8(docname))
|
||||
.arg(QString::fromUtf8(objname));
|
||||
view->setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderDrawingPage::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
|
@ -136,7 +146,13 @@ DrawingView* ViewProviderDrawingPage::showDrawingView()
|
|||
(this->pcObject->getDocument());
|
||||
view = new DrawingView(doc, Gui::getMainWindow());
|
||||
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
|
||||
view->onRelabel(doc);
|
||||
|
||||
const char* docname = pcObject->getDocument()->Label.getValue();
|
||||
const char* objname = pcObject->Label.getValue();
|
||||
QString title = QString::fromAscii("%1 : %2[*]")
|
||||
.arg(QString::fromUtf8(docname))
|
||||
.arg(QString::fromUtf8(objname));
|
||||
view->setWindowTitle(title);
|
||||
Gui::getMainWindow()->addWindow(view);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user