diff options
author | David Faure <faure@kde.org> | 2012-11-30 19:37:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-14 08:56:02 +0100 |
commit | 92bd9aecfb69ebe525ba88dc78ce85e3ca7ed9c2 (patch) | |
tree | 782443b776a374680e2e4ec87a4409fea027ea4d /src/plugins/platforms/xcb | |
parent | 1a653225f6c73d7ca32aa6cdcde45ba9462a7b72 (diff) |
Fix empty window title regression, add application display name to window title
This increases consistency a lot: all windows and dialogs from a Qt
application will show the app display name in the caption, on Windows and X11.
This helps identifying which app a dialog belongs to, which is especially
useful when the dialog is very generic and shows up unexpectedly.
For compatibility reasons, the app name is added to the caption only
if setApplicationDisplayName() was called -- or if the caption would be
completely empty. The standard Qt4 case (setWindowTitle + no display name)
is unchanged.
Change-Id: Ib284c62c1f4c0bc923e5bc2d10247d95e9aa76c1
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 05d7dc4da9..21254e4b3b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1116,7 +1116,18 @@ void QXcbWindow::setParent(const QPlatformWindow *parent) void QXcbWindow::setWindowTitle(const QString &title) { - QByteArray ba = title.toUtf8(); + QString fullTitle = title; + if (QGuiApplicationPrivate::displayName) { + // Append display name, if set. + if (!fullTitle.isEmpty()) + fullTitle += QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH + 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(); + } + const QByteArray ba = fullTitle.toUtf8(); + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, |