diff options
author | David Faure <faure@kde.org> | 2012-06-23 14:08:25 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-27 09:23:15 +0200 |
commit | 2246e48a760823234952031afd247e5d0419e38c (patch) | |
tree | 943afc41b3708de63f821b22456bcfe2f088b7c0 /src/gui/kernel/qguiapplication.cpp | |
parent | ae7e9a407fbcd06926216e9f9bdebc0a8144527c (diff) |
Add QGuiApplication::setApplicationDisplayName.
This is for use in window titles.
Change-Id: I0070a08abd379ae2edcfab4413c182bd9e840678
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index dbee892319..a3d9c1f2ab 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -119,6 +119,7 @@ enum ApplicationResourceFlags static unsigned applicationResourceFlags = 0; QString *QGuiApplicationPrivate::platform_name = 0; +QString *QGuiApplicationPrivate::displayName = 0; QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette @@ -369,6 +370,8 @@ QGuiApplication::~QGuiApplication() delete QGuiApplicationPrivate::platform_name; QGuiApplicationPrivate::platform_name = 0; + delete QGuiApplicationPrivate::displayName; + QGuiApplicationPrivate::displayName = 0; } QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) @@ -382,6 +385,30 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags } /*! + \property QGuiApplication::applicationDisplayName + \brief the user-visible name of this application + \since 5.0 + + This name is shown to the user, for instance in window titles. + It can be translated, if necessary. + + If not set, the application display name defaults to the application name. + + \sa applicationName +*/ +void QGuiApplication::setApplicationDisplayName(const QString &name) +{ + if (!QGuiApplicationPrivate::displayName) + QGuiApplicationPrivate::displayName = new QString; + *QGuiApplicationPrivate::displayName = name; +} + +QString QGuiApplication::applicationDisplayName() +{ + return QGuiApplicationPrivate::displayName ? *QGuiApplicationPrivate::displayName : applicationName(); +} + +/*! Returns the most recently shown modal window. If no modal windows are visible, this function returns zero. |