+ fix DrawingView::onRelabel() to accept any page names
This commit is contained in:
parent
7cc5167623
commit
1b4fb56cdc
|
@ -349,21 +349,11 @@ bool DrawingView::onHasMsg(const char* pMsg) const
|
|||
|
||||
void DrawingView::onRelabel(Gui::Document *pDoc)
|
||||
{
|
||||
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);
|
||||
}
|
||||
if (!bIsPassive && pDoc) {
|
||||
QString cap = QString::fromLatin1("%1 : %2[*]")
|
||||
.arg(QString::fromUtf8(pDoc->getDocument()->Label.getValue()))
|
||||
.arg(objectName());
|
||||
setWindowTitle(cap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,12 +106,11 @@ void ViewProviderDrawingPage::updateData(const App::Property* prop)
|
|||
}
|
||||
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);
|
||||
view->setObjectName(QString::fromUtf8(objname));
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument
|
||||
(pcObject->getDocument());
|
||||
view->onRelabel(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,12 +146,9 @@ DrawingView* ViewProviderDrawingPage::showDrawingView()
|
|||
view = new DrawingView(doc, Gui::getMainWindow());
|
||||
view->setWindowIcon(Gui::BitmapFactory().pixmap("actions/drawing-landscape"));
|
||||
|
||||
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);
|
||||
view->setObjectName(QString::fromUtf8(objname));
|
||||
view->onRelabel(doc);
|
||||
Gui::getMainWindow()->addWindow(view);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user