Gui: fix several regressions caused by PR #12035
* fix hard crash in MainWindow::_updateActions() if no MDI view exists * in MDIView::buildWindowTitle() use the label of the document because this changes when saving it while the name is immutable * fix const correctness in MDIView::buildWindowTitle() * do not set the modified flag of the main window in MDIView::buildWindowTitle() but in the calling instance * move setting the main window title to Application::viewActivated to reduce code duplication * fix missing application name if FreeCADGui is loaded as Python module
This commit is contained in:
@@ -1268,9 +1268,8 @@ void MainWindow::removeWindow(Gui::MDIView* view, bool close)
|
||||
|
||||
void MainWindow::tabChanged(MDIView* view)
|
||||
{
|
||||
Q_UNUSED(view);
|
||||
Q_UNUSED(view)
|
||||
updateActions();
|
||||
getMainWindow()->setWindowTitle(view->buildWindowTitle());
|
||||
}
|
||||
|
||||
void MainWindow::tabCloseRequested(int index)
|
||||
@@ -1665,8 +1664,15 @@ void MainWindow::_updateActions()
|
||||
d->activityTimer->stop();
|
||||
Application::Instance->commandManager().testActive();
|
||||
}
|
||||
|
||||
d->actionUpdateDelay = 0;
|
||||
getMainWindow()->setWindowTitle(activeWindow()->buildWindowTitle());
|
||||
|
||||
if (auto view = activeWindow()) {
|
||||
setWindowTitle(view->buildWindowTitle());
|
||||
if (auto document = view->getGuiDocument()) {
|
||||
setWindowModified(document->isModified());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateEditorActions()
|
||||
@@ -2370,7 +2376,6 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
d->activeView = view;
|
||||
Application::Instance->viewActivated(view);
|
||||
}
|
||||
getMainWindow()->setWindowTitle(view->buildWindowTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2515,8 +2520,10 @@ QMdiArea *MainWindow::getMdiArea() const
|
||||
void MainWindow::setWindowTitle(const QString& string)
|
||||
{
|
||||
QString title;
|
||||
QString appname =
|
||||
QString(static_cast<QApplication*>(QCoreApplication::instance())->applicationName());
|
||||
QString appname = QCoreApplication::applicationName();
|
||||
if (appname.isEmpty()) {
|
||||
appname = QString::fromLatin1(App::Application::Config()["ExeName"].c_str());
|
||||
}
|
||||
|
||||
// allow to disable version number
|
||||
ParameterGrp::handle hGen = +App::GetApplication().GetParameterGroupByPath(
|
||||
|
||||
Reference in New Issue
Block a user