summaryrefslogtreecommitdiffstats
path: root/src/window-lib
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2023-08-22 13:16:03 +0200
committerRobert Griebl <robert.griebl@qt.io>2023-08-22 16:26:00 +0200
commit1f9075cc77b615da72ceb5116ea088466a2716ec (patch)
treeadd0922005453cab30b1a546b197737b836c89ff /src/window-lib
parenta9307c4f4217432743b7c190b72987cf37493655 (diff)
Fix the PackageManager's package role not being usable in strict mode
JS reserves the name "package" in strict mode for future extensions, so you cannot declare a variable or property with this name, effectively breaking access to the package role via a required property. This patch adds a "packageObject" alias role. It also adds similar roles to ApplicationManager, WindowManager and IntentServer to keep the model API as similar as possible between the four classes. Change-Id: Ib9a07cc1107d27c2844367a09a49e6b8c88faf84 Task-number: QTBUG-115998 Pick-to: 6.6 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Diffstat (limited to 'src/window-lib')
-rw-r--r--src/window-lib/windowmanager.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/window-lib/windowmanager.cpp b/src/window-lib/windowmanager.cpp
index e08b4dd0..b5364319 100644
--- a/src/window-lib/windowmanager.cpp
+++ b/src/window-lib/windowmanager.cpp
@@ -69,9 +69,15 @@
\li \c window
\li WindowObject
\target windowmanager-window-role
- \li The WindowObject containing the client surface. To display it you have to put it in a
+ \li The \l WindowObject containing the client surface. To display it you have to put it in a
WindowItem
\row
+ \li \c windowObject
+ \li WindowObject
+ \li Exactly the same as \c window. This was added to keep the role names between the
+ PackageManager and WindowManager models as similar as possible.
+ This role was introduced in Qt version 6.6.
+ \row
\li \c contentState
\li WindowObject::ContentState
\target windowmanager-contentState-role
@@ -207,6 +213,7 @@ enum WMRoles
{
Id = Qt::UserRole + 1000,
WindowRole,
+ WindowObjectRole,
ContentState
};
@@ -352,6 +359,7 @@ WindowManager::WindowManager(QQmlEngine *qmlEngine, const QString &waylandSocket
d->roleNames.insert(WMRoles::Id, "applicationId");
d->roleNames.insert(WMRoles::WindowRole, "window");
+ d->roleNames.insert(WMRoles::WindowObjectRole, "windowObject");
d->roleNames.insert(WMRoles::ContentState, "contentState");
d->qmlEngine = qmlEngine;
@@ -431,6 +439,7 @@ QVariant WindowManager::data(const QModelIndex &index, int role) const
return QString();
}
case WMRoles::WindowRole:
+ case WMRoles::WindowObjectRole:
return QVariant::fromValue(win);
case WMRoles::ContentState:
return win->contentState();