Add notify signals to some QCoreApplication properties
The various string properties are good candidates for exposure to QML. While QCoreApplication itself is unlikely to be exposed to QML directly, a wrapper exposure also needs these signals in order to react to changes from QCoreApplication. Change-Id: I266da6010f1c9300de4bb5e7775a0bdacab7f26c Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
0effb75153
commit
8b0868bb17
@ -2039,9 +2039,21 @@ QStringList QCoreApplication::arguments()
|
||||
\sa organizationDomain, applicationName
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QCoreApplication::organizationNameChanged()
|
||||
\internal
|
||||
|
||||
While not useful from C++ due to how organizationName is normally set once on
|
||||
startup, this is still needed for QML so that bindings are reevaluated after
|
||||
that initial change.
|
||||
*/
|
||||
void QCoreApplication::setOrganizationName(const QString &orgName)
|
||||
{
|
||||
if (coreappdata()->orgName == orgName)
|
||||
return;
|
||||
coreappdata()->orgName = orgName;
|
||||
if (QCoreApplication::self)
|
||||
emit QCoreApplication::self->organizationNameChanged();
|
||||
}
|
||||
|
||||
QString QCoreApplication::organizationName()
|
||||
@ -2067,9 +2079,19 @@ QString QCoreApplication::organizationName()
|
||||
|
||||
\sa organizationName, applicationName, applicationVersion
|
||||
*/
|
||||
/*!
|
||||
\fn void QCoreApplication::organizationDomainChanged()
|
||||
\internal
|
||||
|
||||
Primarily for QML, see organizationNameChanged.
|
||||
*/
|
||||
void QCoreApplication::setOrganizationDomain(const QString &orgDomain)
|
||||
{
|
||||
if (coreappdata()->orgDomain == orgDomain)
|
||||
return;
|
||||
coreappdata()->orgDomain = orgDomain;
|
||||
if (QCoreApplication::self)
|
||||
emit QCoreApplication::self->organizationDomainChanged();
|
||||
}
|
||||
|
||||
QString QCoreApplication::organizationDomain()
|
||||
@ -2089,9 +2111,19 @@ QString QCoreApplication::organizationDomain()
|
||||
|
||||
\sa organizationName, organizationDomain, applicationVersion, applicationFilePath
|
||||
*/
|
||||
/*!
|
||||
\fn void QCoreApplication::applicationNameChanged()
|
||||
\internal
|
||||
|
||||
Primarily for QML, see organizationNameChanged.
|
||||
*/
|
||||
void QCoreApplication::setApplicationName(const QString &application)
|
||||
{
|
||||
if (coreappdata()->application == application)
|
||||
return;
|
||||
coreappdata()->application = application;
|
||||
if (QCoreApplication::self)
|
||||
emit QCoreApplication::self->applicationNameChanged();
|
||||
}
|
||||
|
||||
QString QCoreApplication::applicationName()
|
||||
@ -2118,9 +2150,19 @@ Q_CORE_EXPORT QString qt_applicationName_noFallback()
|
||||
|
||||
\sa applicationName, organizationName, organizationDomain
|
||||
*/
|
||||
/*!
|
||||
\fn void QCoreApplication::applicationVersionChanged()
|
||||
\internal
|
||||
|
||||
Primarily for QML, see organizationNameChanged.
|
||||
*/
|
||||
void QCoreApplication::setApplicationVersion(const QString &version)
|
||||
{
|
||||
if (coreappdata()->applicationVersion == version)
|
||||
return;
|
||||
coreappdata()->applicationVersion = version;
|
||||
if (QCoreApplication::self)
|
||||
emit QCoreApplication::self->applicationVersionChanged();
|
||||
}
|
||||
|
||||
QString QCoreApplication::applicationVersion()
|
||||
|
@ -66,10 +66,10 @@ class QAbstractNativeEventFilter;
|
||||
class Q_CORE_EXPORT QCoreApplication : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName)
|
||||
Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion)
|
||||
Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName)
|
||||
Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain)
|
||||
Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
|
||||
Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion NOTIFY applicationVersionChanged)
|
||||
Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName NOTIFY organizationNameChanged)
|
||||
Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain NOTIFY organizationDomainChanged)
|
||||
Q_PROPERTY(bool quitLockEnabled READ isQuitLockEnabled WRITE setQuitLockEnabled)
|
||||
|
||||
Q_DECLARE_PRIVATE(QCoreApplication)
|
||||
@ -164,6 +164,11 @@ Q_SIGNALS:
|
||||
#endif
|
||||
);
|
||||
|
||||
void organizationNameChanged();
|
||||
void organizationDomainChanged();
|
||||
void applicationNameChanged();
|
||||
void applicationVersionChanged();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user