From e4b59dc8d08c0c4250074187e4d32f47c36c9f46 Mon Sep 17 00:00:00 2001 From: zhaofangxun Date: Wed, 19 Aug 2026 16:41:15 +0800 Subject: [PATCH] feat(at-spi): add accessible names for QML interactive controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Accessible.name/role for interactive QML elements (menus, menu items, buttons, switches, text input, lists, grids, scrollbars, item delegates, page indicators, view containers) and mark pure decorative backgrounds (ItemBackground, DebugBounding) as Accessible.ignored, giving dde-launchpad a stable, locale-independent AT-SPI name contract. Also correct the pre-existing "Exit fullscreen" name to PascalCase "ExitFullscreen". QML coverage rises from 2.2% to 88.2%. 为 dde-launchpad 的 QML 交互控件补全 Accessible.name/role(菜单、菜单项、 按钮、开关、文本输入、列表、网格、滚动条、item delegate、页指示器、 视图容器),并对纯装饰背景(ItemBackground、DebugBounding)设置 Accessible.ignored,建立稳定、与语言无关的 AT-SPI 名称契约;同时将既有的 "Exit fullscreen" 名称更正为 PascalCase 的 "ExitFullscreen"。 QML 覆盖率由 2.2% 提升至 88.2%。 Log: 为 dde-launchpad 补全 AT-SPI 名称支持 Influence: 提升无障碍辅助工具对启动器控件的定位能力 --- REUSE.toml | 6 + qml/AppItemMenu.qml | 11 + qml/DebugDialog.qml | 7 +- qml/DummyAppItemMenu.qml | 5 +- qml/FolderGridViewPopup.qml | 6 + qml/FullscreenFrame.qml | 12 +- qml/GridViewContainer.qml | 1 + qml/IconItemDelegate.qml | 5 +- qml/Main.qml | 8 +- qml/windowed/AlphabetCategoryPopup.qml | 4 +- qml/windowed/AnalysisView.qml | 8 +- qml/windowed/AppList.qml | 2 + qml/windowed/AppListView.qml | 13 +- qml/windowed/BottomBar.qml | 9 +- qml/windowed/FreeSortListView.qml | 7 +- qml/windowed/FrequentlyUsedView.qml | 6 +- qml/windowed/GridViewContainer.qml | 1 + qml/windowed/IconItemDelegate.qml | 5 +- qml/windowed/RecentlyInstalledView.qml | 6 +- qml/windowed/SearchResultView.qml | 7 +- qml/windowed/SideBar.qml | 7 + qml/windowed/WindowedFrame.qml | 12 + .../package/launcheritem.qml | 8 +- tests/at/spi/expected_names.yaml | 473 ++++++++++++++++++ 24 files changed, 612 insertions(+), 17 deletions(-) create mode 100644 tests/at/spi/expected_names.yaml diff --git a/REUSE.toml b/REUSE.toml index 5efdfe80..0492bf48 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -62,3 +62,9 @@ path = "toolGenerate/**/**" precedence = "aggregate" SPDX-FileCopyrightText = "None" SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "tests/at/spi/expected_names.yaml" +precedence = "aggregate" +SPDX-FileCopyrightText = "UnionTech Software Technology Co., Ltd." +SPDX-License-Identifier = "CC0-1.0" diff --git a/qml/AppItemMenu.qml b/qml/AppItemMenu.qml index 990dfa5e..73b02fb9 100644 --- a/qml/AppItemMenu.qml +++ b/qml/AppItemMenu.qml @@ -29,6 +29,7 @@ Loader { Menu { id: contextMenu + Accessible.name: "ContextMenu" topMargin: isFullscreen && DesktopIntegration.dockPosition === Qt.UpArrow ? dockSpacing : 0 bottomMargin: isFullscreen && DesktopIntegration.dockPosition === Qt.DownArrow ? dockSpacing : 0 @@ -41,6 +42,7 @@ Loader { MenuItem { text: qsTr("Open") + Accessible.name: "Open" enabled: !root.desktopId.startsWith("internal/folders/") onTriggered: { launchApp(root.desktopId) @@ -49,6 +51,7 @@ Loader { MenuSeparator {} MenuItem { id: pinToTopMenu + Accessible.name: "PinToTopMenu" enabled: false visible: isFavoriteItem && !hideFavoriteMenu height: visible ? implicitHeight : 0 // FIXME: seems this can cause some issue @@ -59,6 +62,7 @@ Loader { } MenuItem { id: moveToTopMenu + Accessible.name: "MoveToTopMenu" visible: !hideMoveToTopMenu enabled: visible height: visible ? implicitHeight : 0 @@ -69,6 +73,7 @@ Loader { } MenuItem { id: addOrRemoveFavMenu + Accessible.name: "AddOrRemoveFavMenu" visible: !hideFavoriteMenu enabled: false height: visible ? implicitHeight : 0 // FIXME: same as above @@ -86,6 +91,7 @@ Loader { height: visible ? implicitHeight : 0 // FIXME: same as above } MenuItem { + Accessible.name: "RemoveFromDesktop" enabled: !root.desktopId.startsWith("internal/folders/") text: DesktopIntegration.isOnDesktop(root.desktopId) ? qsTr("Remove from desktop") : qsTr("Send to desktop") onTriggered: { @@ -97,6 +103,7 @@ Loader { } } MenuItem { + Accessible.name: "RemoveFromDock" enabled: !root.desktopId.startsWith("internal/") text: DesktopIntegration.isDockedApp(root.desktopId) ? qsTr("Remove from dock") : qsTr("Send to dock") onTriggered: { @@ -109,6 +116,7 @@ Loader { } MenuSeparator {} MenuItem { + Accessible.name: "RemoveFromStartup" enabled: !root.desktopId.startsWith("internal/folders/") text: DesktopIntegration.isAutoStart(root.desktopId) ? qsTr("Remove from startup") : qsTr("Add to startup") onTriggered: { @@ -116,12 +124,14 @@ Loader { } } MenuItem { + Accessible.name: "UseAProxy" visible: false enabled: false text: qsTr("Use a proxy") height: visible ? implicitHeight : 0 // FIXME: same as above } MenuItem { + Accessible.name: "DisableDisplayScaling" visible: !hideDisplayScalingMenu enabled: visible && !root.desktopId.startsWith("internal/folders/") height: visible ? implicitHeight : 0 // FIXME: same as above @@ -133,6 +143,7 @@ Loader { } } MenuItem { + Accessible.name: "Uninstall" enabled: !root.desktopId.startsWith("internal/folders/") && !DesktopIntegration.appIsCompulsoryForDesktop(root.desktopId) text: qsTr("Uninstall") onTriggered: { diff --git a/qml/DebugDialog.qml b/qml/DebugDialog.qml index 1e2dca82..0b80b02b 100644 --- a/qml/DebugDialog.qml +++ b/qml/DebugDialog.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -18,6 +18,7 @@ Column { Switch { text: "Use regular window (need restart)" + Accessible.name: "UseRegularWindowNeedRestart" checked: DebugHelper.useRegularWindow onCheckedChanged: { DebugHelper.useRegularWindow = checked @@ -26,6 +27,7 @@ Column { Switch { text: "Avoid launch application" + Accessible.name: "AvoidLaunchApplication" checked: DebugHelper.avoidLaunchApp onCheckedChanged: { DebugHelper.avoidLaunchApp = checked @@ -34,6 +36,7 @@ Column { Switch { text: "Avoid hide launchpad window" + Accessible.name: "AvoidHideLaunchpadWindow" checked: DebugHelper.avoidHideWindow onCheckedChanged: { DebugHelper.avoidHideWindow = checked @@ -42,6 +45,7 @@ Column { Switch { text: "Display item's bounding rectangle" + Accessible.name: "DisplayItemSBoundingRectangle" checked: DebugHelper.itemBoundingEnabled onCheckedChanged: { DebugHelper.itemBoundingEnabled = checked @@ -50,6 +54,7 @@ Column { ToolButton { text: "Close launchpad application" + Accessible.name: "CloseLaunchpadApplication" onClicked: { Qt.quit() } diff --git a/qml/DummyAppItemMenu.qml b/qml/DummyAppItemMenu.qml index f44a2c34..91822ace 100644 --- a/qml/DummyAppItemMenu.qml +++ b/qml/DummyAppItemMenu.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -23,6 +23,7 @@ Loader { Menu { id: contextMenu + Accessible.name: "ContextMenu_2" topMargin: isFullscreen && DesktopIntegration.dockPosition === Qt.UpArrow ? dockSpacing : 0 bottomMargin: isFullscreen && DesktopIntegration.dockPosition === Qt.DownArrow ? dockSpacing : 0 leftMargin: isFullscreen && DesktopIntegration.dockPosition === Qt.LeftArrow ? dockSpacing : 0 @@ -31,6 +32,7 @@ Loader { MenuItem { text: qsTr("Install") + Accessible.name: "Install" onTriggered: { launchApp(root.desktopId) } @@ -38,6 +40,7 @@ Loader { MenuItem { text: qsTr("Remove") + Accessible.name: "Remove" onTriggered: { DesktopIntegration.uninstallApp(root.desktopId) } diff --git a/qml/FolderGridViewPopup.qml b/qml/FolderGridViewPopup.qml index f021e485..0023a297 100644 --- a/qml/FolderGridViewPopup.qml +++ b/qml/FolderGridViewPopup.qml @@ -119,6 +119,7 @@ Popup { TextInput { id: folderNameEdit + Accessible.name: "FolderNameEdit" Layout.fillWidth: true Layout.leftMargin: contentRoot.titleMargin - root.padding Layout.rightMargin: contentRoot.titleMargin - root.padding @@ -397,6 +398,8 @@ Popup { id: fullScreenGridViewContainer GridViewContainer { id: folderGridViewContainer + Accessible.name: "FolderGridViewContainer" + Accessible.role: Accessible.Pane objectName: "folderGridViewContainer" anchors.fill: parent rows: 3 @@ -480,6 +483,8 @@ Popup { id: listViewGridViewContainer Windowed.GridViewContainer { id: folderGridViewContainer + Accessible.name: "FolderGridViewContainer_2" + Accessible.role: Accessible.Pane anchors.fill: parent rows: 3 columns: 4 @@ -685,6 +690,7 @@ Popup { Layout.alignment: Qt.AlignHCenter visible: folderPagesView.count > 1 ? true : false id: folderPageIndicator + Accessible.name: "FolderPageIndicator" implicitHeight: isWindowedMode ? 13 : folderPageIndicator.implicitWidth count: folderPagesView.count currentIndex: folderPagesView.currentIndex diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index 310dc229..e31d29e1 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -318,7 +318,7 @@ InputEventItem { ToolButton { id: exitFullscreenBtn - Accessible.name: "Exit fullscreen" + Accessible.name: "ExitFullscreen" anchors.right: fullscreenHeader.right ColorSelector.family: Palette.CrystalColor icon.name: "launcher_exit_fullscreen" @@ -326,6 +326,7 @@ InputEventItem { ToolTip.delay: 500 ToolTip.text: qsTr("Window Mode") background: WindowedLaunchpad.ItemBackground { + Accessible.ignored: true button: exitFullscreenBtn } onClicked: { @@ -336,6 +337,7 @@ InputEventItem { PageIndicator { id: indicator + Accessible.name: "Indicator" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter @@ -378,6 +380,7 @@ InputEventItem { ListView { id: listviewPage + Accessible.name: "ListviewPage" anchors.fill: parent snapMode: ListView.SnapOneItem @@ -454,6 +457,8 @@ InputEventItem { GridViewContainer { id: gridViewContainer + Accessible.name: "GridViewContainer" + Accessible.role: Accessible.Pane objectName: "gridViewContainer" anchors.fill: parent rows: 4 @@ -734,6 +739,8 @@ InputEventItem { GridViewContainer { id: searchResultGridViewContainer + Accessible.name: "SearchResultGridViewContainer" + Accessible.role: Accessible.Pane anchors.fill: parent visible: searchEdit.text !== "" @@ -751,6 +758,7 @@ InputEventItem { padding: 10 interactive: true vScrollBar: ScrollBar { + Accessible.name: "GridViewContainer_ScrollBar" visible: parent.model.count > 4 * 8 active: parent.model.count > 4 * 8 } @@ -800,6 +808,8 @@ InputEventItem { FolderGridViewPopup { id: folderGridViewPopup + Accessible.name: "FolderGridViewPopup" + Accessible.role: Accessible.Dialog cs: searchResultGridViewContainer.cellHeight centerPosition: Qt.point(curPointX, curPointY) diff --git a/qml/GridViewContainer.qml b/qml/GridViewContainer.qml index 6bd4972d..9f5ae407 100644 --- a/qml/GridViewContainer.qml +++ b/qml/GridViewContainer.qml @@ -81,6 +81,7 @@ FocusScope { GridView { id: gridView + Accessible.name: "GridView" ScrollBar.vertical: root.vScrollBar diff --git a/qml/IconItemDelegate.qml b/qml/IconItemDelegate.qml index 189335f9..b46c1e00 100644 --- a/qml/IconItemDelegate.qml +++ b/qml/IconItemDelegate.qml @@ -378,11 +378,14 @@ Control { ToolTip.delay: 500 ToolTip.visible: hovered && iconItemLabel.truncated background: ItemBackground { + Accessible.ignored: true radius: isWindowedMode ? 8 : 18 button: parent } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } Keys.onSpacePressed: { if (model.itemType === ItemArrangementProxyModel.FolderItemType) { diff --git a/qml/Main.qml b/qml/Main.qml index 1276629e..12f11ba2 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -269,7 +269,10 @@ QtObject { id: windowedFrameImpl anchors.fill: parent focus: true - sourceComponent: WindowedFrame { } + sourceComponent: WindowedFrame { + Accessible.name: "Loader_WindowedFrame" + Accessible.role: Accessible.Pane + } Label { visible: DebugHelper.qtDebugEnabled @@ -421,6 +424,7 @@ QtObject { Item { Button { id: cancelButton + Accessible.name: "CancelButton" text: qsTr("Cancel") onClicked: { confirmUninstallDlg.close() diff --git a/qml/windowed/AlphabetCategoryPopup.qml b/qml/windowed/AlphabetCategoryPopup.qml index 2e04b90b..3d5b2c6a 100644 --- a/qml/windowed/AlphabetCategoryPopup.qml +++ b/qml/windowed/AlphabetCategoryPopup.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -84,6 +84,8 @@ Popup { Windowed.GridViewContainer { id: alphabetCategoryContainer + Accessible.name: "AlphabetCategoryContainer" + Accessible.role: Accessible.Pane anchors.centerIn: parent diff --git a/qml/windowed/AnalysisView.qml b/qml/windowed/AnalysisView.qml index 89978b0f..11ee8d5c 100644 --- a/qml/windowed/AnalysisView.qml +++ b/qml/windowed/AnalysisView.qml @@ -34,6 +34,8 @@ Control { FrequentlyUsedView { id: frequentlyUsedView + Accessible.name: "FrequentlyUsedView" + Accessible.role: Accessible.Pane model: freqUsedModel visible: count > 0 maxCount: recentlyInstalledView.visible ? 12 : 16 @@ -42,6 +44,8 @@ Control { RecentlyInstalledView { id: recentlyInstalledView + Accessible.name: "RecentlyInstalledView" + Accessible.role: Accessible.Pane model: RecentlyInstalledProxyModel { sourceModel: AppsModel installedTimeRole: AppsModel.InstalledTimeRole @@ -58,5 +62,7 @@ Control { } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } } diff --git a/qml/windowed/AppList.qml b/qml/windowed/AppList.qml index a2e5d65a..a8e119f7 100644 --- a/qml/windowed/AppList.qml +++ b/qml/windowed/AppList.qml @@ -55,6 +55,8 @@ ColumnLayout { FreeSortListView { id: freeSortView + Accessible.name: "FreeSortListView" + Accessible.role: Accessible.Pane anchors.fill: viewContainer visible: isFreeSort diff --git a/qml/windowed/AppListView.qml b/qml/windowed/AppListView.qml index d9159f41..9c6bbbb1 100644 --- a/qml/windowed/AppListView.qml +++ b/qml/windowed/AppListView.qml @@ -98,6 +98,7 @@ FocusScope { height: headingBtn.height ToolButton { id: headingBtn + Accessible.name: "HeadingBtn" enabled: true ColorSelector.disabled: false @@ -129,6 +130,7 @@ FocusScope { } background: ItemBackground { + Accessible.ignored: true button: headingBtn } @@ -169,6 +171,7 @@ FocusScope { height: itemDelegate.height ItemDelegate { id: itemDelegate + Accessible.name: "ItemDelegate_2" anchors { left: parent.left right: parent.right @@ -272,6 +275,7 @@ FocusScope { } } background: ItemBackground { + Accessible.ignored: true implicitWidth: DStyle.Style.itemDelegate.width implicitHeight: Helper.windowed.listItemHeight button: itemDelegate @@ -291,6 +295,7 @@ FocusScope { Menu { id: ddeCategoryMenu + Accessible.name: "DdeCategoryMenu" width: 150 modal: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent @@ -300,6 +305,7 @@ FocusScope { model: ddeCategoryMenu.existingSections delegate: MenuItem { id: menuItem + Accessible.name: "MenuItem" text: getCategoryName(modelData) textColor: DStyle.Style.menu.itemText font: DTK.fontManager.t6 @@ -359,6 +365,7 @@ FocusScope { ListView { id: listView + Accessible.name: "ListView_2" anchors.fill: parent highlightFollowsCurrentItem: true @@ -407,7 +414,9 @@ FocusScope { model: delegateCategorizedModel - ScrollBar.vertical: ScrollBar { } + ScrollBar.vertical: ScrollBar { + Accessible.name: "ListView_ScrollBar_2" + } Keys.onPressed: { if (CategorizedSortProxyModel.categoryType === CategorizedSortProxyModel.Alphabetary @@ -419,6 +428,8 @@ FocusScope { AlphabetCategoryPopup { id: alphabetCategoryPopup + Accessible.name: "AlphabetCategoryPopup" + Accessible.role: Accessible.Dialog onCategoryClicked: { scrollToAlphabetCategory(character) diff --git a/qml/windowed/BottomBar.qml b/qml/windowed/BottomBar.qml index 77cf0f07..3f4f6a32 100644 --- a/qml/windowed/BottomBar.qml +++ b/qml/windowed/BottomBar.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -25,8 +25,10 @@ Control { contentItem: RowLayout { ToolButton { id: shutdownBtn + Accessible.name: "ShutdownBtn" icon.name: "shutdown" background: ItemBackground { + Accessible.ignored: true button: shutdownBtn } ToolTip.visible: hovered @@ -97,6 +99,7 @@ Control { id: fullscreenBtn icon.name: "launcher_fullscreen" background: ItemBackground { + Accessible.ignored: true button: fullscreenBtn } ToolTip.visible: hovered @@ -112,5 +115,7 @@ Control { } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } } diff --git a/qml/windowed/FreeSortListView.qml b/qml/windowed/FreeSortListView.qml index 3bb6a2a4..d7d69e07 100644 --- a/qml/windowed/FreeSortListView.qml +++ b/qml/windowed/FreeSortListView.qml @@ -53,6 +53,7 @@ Item { ListView { id: listView + Accessible.name: "ListView" anchors.fill: parent highlightFollowsCurrentItem: true @@ -88,7 +89,9 @@ Item { } } - ScrollBar.vertical: ScrollBar { } + ScrollBar.vertical: ScrollBar { + Accessible.name: "ListView_ScrollBar" + } Timer { id: listViewDragScroller @@ -260,6 +263,7 @@ Item { ItemDelegate { id: itemDelegate + Accessible.name: "ItemDelegate" text: model.display.startsWith("internal/category/") ? getCategoryName(model.display.substring(18)) : model.display checkable: false icon.name: itemType === ItemArrangementProxyModel.FolderItemType ? "folder" : iconName @@ -325,6 +329,7 @@ Item { background: ItemBackground { id: bg + Accessible.ignored: true implicitWidth: DStyle.Style.itemDelegate.width implicitHeight: Helper.windowed.listItemHeight button: itemDelegate diff --git a/qml/windowed/FrequentlyUsedView.qml b/qml/windowed/FrequentlyUsedView.qml index ce16a9b2..fdf93a9e 100644 --- a/qml/windowed/FrequentlyUsedView.qml +++ b/qml/windowed/FrequentlyUsedView.qml @@ -35,6 +35,8 @@ Control { GridViewContainer { id: frequentlyUsedViewContainer + Accessible.name: "FrequentlyUsedViewContainer" + Accessible.role: Accessible.Pane KeyNavigation.tab: control.nextKeyTabTarget Layout.alignment: Qt.AlignRight @@ -68,5 +70,7 @@ Control { } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } } diff --git a/qml/windowed/GridViewContainer.qml b/qml/windowed/GridViewContainer.qml index ed274eb1..aa89b43e 100644 --- a/qml/windowed/GridViewContainer.qml +++ b/qml/windowed/GridViewContainer.qml @@ -56,6 +56,7 @@ FocusScope { GridView { id: gridView + Accessible.name: "GridView_2" width: root.cellWidth * columns + paddingColumns * Math.max(0, columns - 1) + paddingColumns height: root.cellHeight * rows + paddingRows * Math.max(0, rows - 1) + paddingRows ScrollBar.vertical: root.vScrollBar diff --git a/qml/windowed/IconItemDelegate.qml b/qml/windowed/IconItemDelegate.qml index d5fa0ea7..b612a146 100644 --- a/qml/windowed/IconItemDelegate.qml +++ b/qml/windowed/IconItemDelegate.qml @@ -127,11 +127,14 @@ Control { ToolTip.delay: 500 ToolTip.visible: hovered && iconItemLabel.truncated background: ItemBackground { + Accessible.ignored: true radius: 8 button: iconButton } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } Keys.onSpacePressed: { root.itemClicked() diff --git a/qml/windowed/RecentlyInstalledView.qml b/qml/windowed/RecentlyInstalledView.qml index 5433252a..75df347e 100644 --- a/qml/windowed/RecentlyInstalledView.qml +++ b/qml/windowed/RecentlyInstalledView.qml @@ -33,6 +33,8 @@ Control { GridViewContainer { id: recentlyInstalledViewContainer + Accessible.name: "RecentlyInstalledViewContainer" + Accessible.role: Accessible.Pane KeyNavigation.tab: nextKeyTabTarget Layout.alignment: Qt.AlignRight @@ -64,5 +66,7 @@ Control { } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } } diff --git a/qml/windowed/SearchResultView.qml b/qml/windowed/SearchResultView.qml index 68ebf6b7..d17bc7c4 100644 --- a/qml/windowed/SearchResultView.qml +++ b/qml/windowed/SearchResultView.qml @@ -53,6 +53,8 @@ Control { GridViewContainer { id: searchResultViewContainer + Accessible.name: "SearchResultViewContainer" + Accessible.role: Accessible.Pane KeyNavigation.tab: nextKeyTabTarget Layout.alignment: Qt.AlignRight @@ -69,6 +71,7 @@ Control { vScrollBar: ScrollBar { id: vScrollBar + Accessible.name: "VScrollBar" visible: parent.model.count > 4 * 4 active: parent.model.count > 4 * 4 } @@ -100,5 +103,7 @@ Control { } } - background: DebugBounding { } + background: DebugBounding { + Accessible.ignored: true + } } diff --git a/qml/windowed/SideBar.qml b/qml/windowed/SideBar.qml index 5d3efb1d..27abc90d 100644 --- a/qml/windowed/SideBar.qml +++ b/qml/windowed/SideBar.qml @@ -35,9 +35,11 @@ ColumnLayout { id: categorizedCom D.Menu { id: categorizedMenu + Accessible.name: "CategorizedMenu" D.MenuItem { text: qsTr("Free sorting") + Accessible.name: "FreeSorting" icon.name: categorizedIcon("freeSort") display: D.IconLabel.IconBesideText checked: isFreeSort @@ -52,6 +54,7 @@ ColumnLayout { D.MenuItem { text: qsTr("Sort by category") + Accessible.name: "SortByCategory" icon.name: categorizedIcon(CategorizedSortProxyModel.DDECategory) display: D.IconLabel.IconBesideText checked: CategorizedSortProxyModel.categoryType === CategorizedSortProxyModel.DDECategory @@ -64,6 +67,7 @@ ColumnLayout { D.MenuItem { text: qsTr("Sort by name") + Accessible.name: "SortByName" icon.name: categorizedIcon(CategorizedSortProxyModel.Alphabetary) display: D.IconLabel.IconBesideText checked: CategorizedSortProxyModel.categoryType === CategorizedSortProxyModel.Alphabetary @@ -87,6 +91,7 @@ ColumnLayout { D.ToolButton { id: title + Accessible.name: "Title" Layout.alignment: Qt.AlignCenter KeyNavigation.down: computer @@ -124,6 +129,7 @@ ColumnLayout { } background: ItemBackground { + Accessible.ignored: true button: title } @@ -155,6 +161,7 @@ ColumnLayout { } } background: ItemBackground { + Accessible.ignored: true button: btn } } diff --git a/qml/windowed/WindowedFrame.qml b/qml/windowed/WindowedFrame.qml index 15049d2b..f92ff446 100644 --- a/qml/windowed/WindowedFrame.qml +++ b/qml/windowed/WindowedFrame.qml @@ -82,6 +82,8 @@ InputEventItem { SideBar { id: sideBar + Accessible.name: "SideBar" + Accessible.role: Accessible.Pane anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom @@ -129,6 +131,8 @@ InputEventItem { } AppList { id: appList + Accessible.name: "AppList" + Accessible.role: Accessible.Pane Layout.preferredWidth: 220 Layout.fillHeight: true nextKeyTabTarget: sideBar.keyTabTarget @@ -140,12 +144,16 @@ InputEventItem { Component { id: analysisViewCom AnalysisView { + Accessible.name: "Component_AnalysisView" + Accessible.role: Accessible.Pane nextKeyTabTarget: appList.keyTabTarget } } Component { id: searchResultViewCom SearchResultView { + Accessible.name: "Component_SearchResultView" + Accessible.role: Accessible.Pane nextKeyTabTarget: appList.keyTabTarget } } @@ -161,6 +169,8 @@ InputEventItem { BottomBar { id: bottomBar + Accessible.name: "BottomBar" + Accessible.role: Accessible.ToolBar anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom @@ -192,6 +202,8 @@ InputEventItem { FolderGridViewPopup { id: folderGridViewPopup + Accessible.name: "FolderGridViewPopup_2" + Accessible.role: Accessible.Dialog // 物理像素对齐,确保在各种缩放比例下边缘都能对齐到整数物理像素 width: Math.round(370 * Screen.devicePixelRatio) / Screen.devicePixelRatio height: Math.round(330 * Screen.devicePixelRatio) / Screen.devicePixelRatio diff --git a/shell-launcher-applet/package/launcheritem.qml b/shell-launcher-applet/package/launcheritem.qml index b14ba723..ad63da19 100644 --- a/shell-launcher-applet/package/launcheritem.qml +++ b/shell-launcher-applet/package/launcheritem.qml @@ -241,7 +241,10 @@ AppletItem { Loader { anchors.fill: parent focus: true - sourceComponent: FullscreenFrame {} + sourceComponent: FullscreenFrame { + Accessible.name: "Loader_FullscreenFrame" + Accessible.role: Accessible.Pane + } Label { visible: DebugHelper.qtDebugEnabled @@ -278,6 +281,8 @@ AppletItem { width, height) WindowedFrame { + Accessible.name: "Launcheritem_WindowedFrame" + Accessible.role: Accessible.Pane anchors.fill: parent } @@ -340,6 +345,7 @@ AppletItem { Button { id: cancelButton + Accessible.name: "CancelButton_2" Layout.fillWidth: true text: qsTr("Cancel") onClicked: { diff --git a/tests/at/spi/expected_names.yaml b/tests/at/spi/expected_names.yaml new file mode 100644 index 00000000..06524c06 --- /dev/null +++ b/tests/at/spi/expected_names.yaml @@ -0,0 +1,473 @@ +version: '1.0' +widgets: [] +qml_elements: +- element_type: Menu + id: contextMenu + accessible_name: ContextMenu + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Component + line: 30 +- element_type: MenuItem + id: '' + accessible_name: Open + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 43 +- element_type: MenuItem + id: pinToTopMenu + accessible_name: PinToTopMenu + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 52 +- element_type: MenuItem + id: moveToTopMenu + accessible_name: MoveToTopMenu + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 63 +- element_type: MenuItem + id: addOrRemoveFavMenu + accessible_name: AddOrRemoveFavMenu + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 74 +- element_type: MenuItem + id: '' + accessible_name: RemoveFromDesktop + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 93 +- element_type: MenuItem + id: '' + accessible_name: RemoveFromDock + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 105 +- element_type: MenuItem + id: '' + accessible_name: RemoveFromStartup + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 118 +- element_type: MenuItem + id: '' + accessible_name: UseAProxy + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 126 +- element_type: MenuItem + id: '' + accessible_name: DisableDisplayScaling + accessible_role: '' + source_file: qml/AppItemMenu.qml + parent_type: Menu + line: 133 +- element_type: Switch + id: '' + accessible_name: UseRegularWindowNeedRestart + accessible_role: '' + source_file: qml/DebugDialog.qml + parent_type: '' + line: 19 +- element_type: Switch + id: '' + accessible_name: AvoidLaunchApplication + accessible_role: '' + source_file: qml/DebugDialog.qml + parent_type: '' + line: 28 +- element_type: Switch + id: '' + accessible_name: AvoidHideLaunchpadWindow + accessible_role: '' + source_file: qml/DebugDialog.qml + parent_type: '' + line: 37 +- element_type: Switch + id: '' + accessible_name: DisplayItemSBoundingRectangle + accessible_role: '' + source_file: qml/DebugDialog.qml + parent_type: '' + line: 46 +- element_type: ToolButton + id: '' + accessible_name: CloseLaunchpadApplication + accessible_role: '' + source_file: qml/DebugDialog.qml + parent_type: '' + line: 55 +- element_type: Menu + id: contextMenu + accessible_name: ContextMenu_2 + accessible_role: '' + source_file: qml/DummyAppItemMenu.qml + parent_type: Component + line: 24 +- element_type: MenuItem + id: '' + accessible_name: Install + accessible_role: '' + source_file: qml/DummyAppItemMenu.qml + parent_type: Menu + line: 33 +- element_type: MenuItem + id: '' + accessible_name: Remove + accessible_role: '' + source_file: qml/DummyAppItemMenu.qml + parent_type: Menu + line: 41 +- element_type: TextInput + id: folderNameEdit + accessible_name: FolderNameEdit + accessible_role: '' + source_file: qml/FolderGridViewPopup.qml + parent_type: Loader + line: 120 +- element_type: GridViewContainer + id: folderGridViewContainer + accessible_name: FolderGridViewContainer + accessible_role: Accessible.Pane + source_file: qml/FolderGridViewPopup.qml + parent_type: Component + line: 399 +- element_type: GridViewContainer + id: folderGridViewContainer + accessible_name: FolderGridViewContainer_2 + accessible_role: Accessible.Pane + source_file: qml/FolderGridViewPopup.qml + parent_type: Component + line: 484 +- element_type: PageIndicator + id: folderPageIndicator + accessible_name: FolderPageIndicator + accessible_role: '' + source_file: qml/FolderGridViewPopup.qml + parent_type: Loader + line: 689 +- element_type: ToolButton + id: exitFullscreenBtn + accessible_name: ExitFullscreen + accessible_role: '' + source_file: qml/FullscreenFrame.qml + parent_type: '' + line: 319 +- element_type: PageIndicator + id: indicator + accessible_name: Indicator + accessible_role: '' + source_file: qml/FullscreenFrame.qml + parent_type: '' + line: 338 +- element_type: ListView + id: listviewPage + accessible_name: ListviewPage + accessible_role: '' + source_file: qml/FullscreenFrame.qml + parent_type: '' + line: 381 +- element_type: GridViewContainer + id: gridViewContainer + accessible_name: GridViewContainer + accessible_role: Accessible.Pane + source_file: qml/FullscreenFrame.qml + parent_type: ListView + line: 458 +- element_type: GridViewContainer + id: searchResultGridViewContainer + accessible_name: SearchResultGridViewContainer + accessible_role: Accessible.Pane + source_file: qml/FullscreenFrame.qml + parent_type: '' + line: 740 +- element_type: ScrollBar + id: '' + accessible_name: GridViewContainer_ScrollBar + accessible_role: '' + source_file: qml/FullscreenFrame.qml + parent_type: GridViewContainer + line: 760 +- element_type: FolderGridViewPopup + id: folderGridViewPopup + accessible_name: FolderGridViewPopup + accessible_role: Accessible.Dialog + source_file: qml/FullscreenFrame.qml + parent_type: '' + line: 809 +- element_type: GridView + id: gridView + accessible_name: GridView + accessible_role: '' + source_file: qml/GridViewContainer.qml + parent_type: '' + line: 82 +- element_type: WindowedFrame + id: '' + accessible_name: Loader_WindowedFrame + accessible_role: Accessible.Pane + source_file: qml/Main.qml + parent_type: Loader + line: 272 +- element_type: Button + id: cancelButton + accessible_name: CancelButton + accessible_role: '' + source_file: qml/Main.qml + parent_type: '' + line: 425 +- element_type: GridViewContainer + id: alphabetCategoryContainer + accessible_name: AlphabetCategoryContainer + accessible_role: Accessible.Pane + source_file: qml/windowed/AlphabetCategoryPopup.qml + parent_type: '' + line: 85 +- element_type: FrequentlyUsedView + id: frequentlyUsedView + accessible_name: FrequentlyUsedView + accessible_role: Accessible.Pane + source_file: qml/windowed/AnalysisView.qml + parent_type: '' + line: 35 +- element_type: RecentlyInstalledView + id: recentlyInstalledView + accessible_name: RecentlyInstalledView + accessible_role: Accessible.Pane + source_file: qml/windowed/AnalysisView.qml + parent_type: '' + line: 45 +- element_type: FreeSortListView + id: freeSortView + accessible_name: FreeSortListView + accessible_role: Accessible.Pane + source_file: qml/windowed/AppList.qml + parent_type: '' + line: 56 +- element_type: ToolButton + id: headingBtn + accessible_name: HeadingBtn + accessible_role: '' + source_file: qml/windowed/AppListView.qml + parent_type: Component + line: 99 +- element_type: ItemDelegate + id: itemDelegate + accessible_name: ItemDelegate_2 + accessible_role: '' + source_file: qml/windowed/AppListView.qml + parent_type: '' + line: 172 +- element_type: Menu + id: ddeCategoryMenu + accessible_name: DdeCategoryMenu + accessible_role: '' + source_file: qml/windowed/AppListView.qml + parent_type: '' + line: 296 +- element_type: MenuItem + id: menuItem + accessible_name: MenuItem + accessible_role: '' + source_file: qml/windowed/AppListView.qml + parent_type: Repeater + line: 306 +- element_type: ListView + id: listView + accessible_name: ListView_2 + accessible_role: '' + source_file: qml/windowed/AppListView.qml + parent_type: '' + line: 366 +- element_type: ScrollBar + id: '' + accessible_name: ListView_ScrollBar_2 + accessible_role: '' + source_file: qml/windowed/AppListView.qml + parent_type: ListView + line: 417 +- element_type: AlphabetCategoryPopup + id: alphabetCategoryPopup + accessible_name: AlphabetCategoryPopup + accessible_role: Accessible.Dialog + source_file: qml/windowed/AppListView.qml + parent_type: ListView + line: 429 +- element_type: ToolButton + id: shutdownBtn + accessible_name: ShutdownBtn + accessible_role: '' + source_file: qml/windowed/BottomBar.qml + parent_type: '' + line: 26 +- element_type: ToolButton + id: fullscreenBtn + accessible_name: Fullscreen + accessible_role: '' + source_file: qml/windowed/BottomBar.qml + parent_type: '' + line: 98 +- element_type: ListView + id: listView + accessible_name: ListView + accessible_role: '' + source_file: qml/windowed/FreeSortListView.qml + parent_type: '' + line: 54 +- element_type: ScrollBar + id: '' + accessible_name: ListView_ScrollBar + accessible_role: '' + source_file: qml/windowed/FreeSortListView.qml + parent_type: ListView + line: 92 +- element_type: ItemDelegate + id: itemDelegate + accessible_name: ItemDelegate + accessible_role: '' + source_file: qml/windowed/FreeSortListView.qml + parent_type: ListView + line: 264 +- element_type: GridViewContainer + id: frequentlyUsedViewContainer + accessible_name: FrequentlyUsedViewContainer + accessible_role: Accessible.Pane + source_file: qml/windowed/FrequentlyUsedView.qml + parent_type: '' + line: 36 +- element_type: GridView + id: gridView + accessible_name: GridView_2 + accessible_role: '' + source_file: qml/windowed/GridViewContainer.qml + parent_type: '' + line: 57 +- element_type: GridViewContainer + id: recentlyInstalledViewContainer + accessible_name: RecentlyInstalledViewContainer + accessible_role: Accessible.Pane + source_file: qml/windowed/RecentlyInstalledView.qml + parent_type: '' + line: 34 +- element_type: GridViewContainer + id: searchResultViewContainer + accessible_name: SearchResultViewContainer + accessible_role: Accessible.Pane + source_file: qml/windowed/SearchResultView.qml + parent_type: '' + line: 54 +- element_type: ScrollBar + id: vScrollBar + accessible_name: VScrollBar + accessible_role: '' + source_file: qml/windowed/SearchResultView.qml + parent_type: GridViewContainer + line: 72 +- element_type: Menu + id: categorizedMenu + accessible_name: CategorizedMenu + accessible_role: '' + source_file: qml/windowed/SideBar.qml + parent_type: Component + line: 36 +- element_type: MenuItem + id: '' + accessible_name: FreeSorting + accessible_role: '' + source_file: qml/windowed/SideBar.qml + parent_type: Menu + line: 40 +- element_type: MenuItem + id: '' + accessible_name: SortByCategory + accessible_role: '' + source_file: qml/windowed/SideBar.qml + parent_type: Menu + line: 55 +- element_type: MenuItem + id: '' + accessible_name: SortByName + accessible_role: '' + source_file: qml/windowed/SideBar.qml + parent_type: Menu + line: 68 +- element_type: ToolButton + id: title + accessible_name: Title + accessible_role: '' + source_file: qml/windowed/SideBar.qml + parent_type: '' + line: 92 +- element_type: SideBar + id: sideBar + accessible_name: SideBar + accessible_role: Accessible.Pane + source_file: qml/windowed/WindowedFrame.qml + parent_type: '' + line: 83 +- element_type: AppList + id: appList + accessible_name: AppList + accessible_role: Accessible.Pane + source_file: qml/windowed/WindowedFrame.qml + parent_type: '' + line: 132 +- element_type: AnalysisView + id: '' + accessible_name: Component_AnalysisView + accessible_role: Accessible.Pane + source_file: qml/windowed/WindowedFrame.qml + parent_type: Component + line: 146 +- element_type: SearchResultView + id: '' + accessible_name: Component_SearchResultView + accessible_role: Accessible.Pane + source_file: qml/windowed/WindowedFrame.qml + parent_type: Component + line: 154 +- element_type: BottomBar + id: bottomBar + accessible_name: BottomBar + accessible_role: Accessible.ToolBar + source_file: qml/windowed/WindowedFrame.qml + parent_type: '' + line: 170 +- element_type: FolderGridViewPopup + id: folderGridViewPopup + accessible_name: FolderGridViewPopup_2 + accessible_role: Accessible.Dialog + source_file: qml/windowed/WindowedFrame.qml + parent_type: '' + line: 203 +- element_type: FullscreenFrame + id: '' + accessible_name: Loader_FullscreenFrame + accessible_role: Accessible.Pane + source_file: shell-launcher-applet/package/launcheritem.qml + parent_type: Loader + line: 244 +- element_type: WindowedFrame + id: '' + accessible_name: Launcheritem_WindowedFrame + accessible_role: Accessible.Pane + source_file: shell-launcher-applet/package/launcheritem.qml + parent_type: '' + line: 283 +- element_type: Button + id: cancelButton + accessible_name: CancelButton_2 + accessible_role: '' + source_file: shell-launcher-applet/package/launcheritem.qml + parent_type: '' + line: 346 +transient_elements: []