nested mdi: Fix MDI's frame title not being updated

Before we didn't need to update it because there was only 1
dock widget. But now, if there's more than one we need to set the
application's name instead of the dock widget's name as title.
This commit is contained in:
Sergio Martins
2022-01-14 12:24:03 +00:00
parent 074bc26be9
commit 296b2a3370
4 changed files with 31 additions and 1 deletions

View File

@@ -237,6 +237,17 @@ QString DockWidgetBase::uniqueName() const
QString DockWidgetBase::title() const
{
if (d->isMDIWrapper()) {
// It's just a wrapper to help implementing Option_MDINestable. Return the title of the real dock widget we're hosting.
auto dropAreaGuest = qobject_cast<DropArea*>(widget());
Q_ASSERT(dropAreaGuest);
if (dropAreaGuest->hasSingleFrame()) {
return dropAreaGuest->frames().constFirst()->title();
} else {
return qApp->applicationName();
}
}
return d->title;
}