summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 88a82b12a3..1eec6bfefc 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -42,6 +42,7 @@
#include "qplatformwindow.h"
#include "qplatformwindow_p.h"
+#include <private/qguiapplication_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/qwindow.h>
#include <QtGui/qscreen.h>
@@ -437,6 +438,29 @@ bool QPlatformWindow::frameStrutEventsEnabled() const
}
/*!
+ Call this method to put together a window title composed of
+ \a title
+ \a separator
+ the application display name
+
+ If the display name isn't set, and the title is empty, the raw app name is used.
+*/
+QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &separator)
+{
+ QString fullTitle = title;
+ if (QGuiApplicationPrivate::displayName) {
+ // Append display name, if set.
+ if (!fullTitle.isEmpty())
+ fullTitle += separator;
+ fullTitle += *QGuiApplicationPrivate::displayName;
+ } else if (fullTitle.isEmpty()) {
+ // Don't let the window title be completely empty, use the app name as fallback.
+ fullTitle = QCoreApplication::applicationName();
+ }
+ return fullTitle;
+}
+
+/*!
\class QPlatformWindow
\since 4.8
\internal