Add Accessibility properties

Also clean up increase and decrease actions for Slider a tiny bit.
This commit is contained in:
Frederik Gladhorn 2014-07-07 19:20:57 +02:00
parent 596dc7523d
commit 2f93b7f764
18 changed files with 68 additions and 31 deletions

View File

@ -278,4 +278,13 @@ Item {
onTriggered: Tooltip.showText(mouse, Qt.point(mouse.mouseX, mouse.mouseY), tooltip) onTriggered: Tooltip.showText(mouse, Qt.point(mouse.mouseX, mouse.mouseY), tooltip)
} }
} }
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: tooltip
Accessible.checkable: checkable
Accessible.checked: checked
function accessiblePressAction() {
internal.clickButton()
}
} }

View File

@ -70,6 +70,8 @@ PlasmaComponents.Dialog {
*/ */
signal buttonClicked(int index) signal buttonClicked(int index)
Accessible.role: Accessible.Dialog
onButtonTextsChanged: { onButtonTextsChanged: {
print("btex6tchanged:" + buttonTexts); print("btex6tchanged:" + buttonTexts);
for (var i = buttonRow.children.length; i > 0; --i) { for (var i = buttonRow.children.length; i > 0; --i) {

View File

@ -51,4 +51,7 @@ Text {
color: theme.textColor color: theme.textColor
opacity: enabled? 1 : 0.6 opacity: enabled? 1 : 0.6
Accessible.role: Accessible.StaticText
Accessible.name: text
} }

View File

@ -137,4 +137,6 @@ Item {
} }
} }
} }
Accessible.role: Accessible.ListItem
} }

View File

@ -80,4 +80,5 @@ PlasmaComponents.ContextMenu {
} }
} }
} }
Accessible.role: Accessible.PopupMenu
} }

View File

@ -136,4 +136,6 @@ Item {
to: background._isVertical ? background.height - bar.height : background.width - bar.width to: background._isVertical ? background.height - bar.height : background.width - bar.width
} }
} }
Accessible.role: Accessible.ProgressBar
} }

View File

@ -63,4 +63,5 @@ Private.DualStateButton {
activeFocusOnTab: true activeFocusOnTab: true
shadow: Private.RoundShadow {} shadow: Private.RoundShadow {}
Accessible.role: Accessible.RadioButton
} }

View File

@ -215,4 +215,5 @@ Item {
source: interactive ? "private/ScrollBarDelegate.qml" : "private/ScrollDecoratorDelegate.qml" source: interactive ? "private/ScrollBarDelegate.qml" : "private/ScrollDecoratorDelegate.qml"
} }
Accessible.role: Accessible.ScrollBar
} }

View File

@ -179,4 +179,5 @@ Item {
listView.model.itemsRemoved.connect(dirtyObserver); listView.model.itemsRemoved.connect(dirtyObserver);
} }
} }
Accessible.role: Accessible.ScrollBar
} }

View File

@ -112,43 +112,24 @@ Item {
activeFocusOnTab: true activeFocusOnTab: true
Keys.onUpPressed: { Keys.onUpPressed: { if (contents.isVertical) decrease() }
if (!enabled || !contents.isVertical) Keys.onDownPressed: { if (contents.isVertical) increase() }
Keys.onLeftPressed: { if (!contents.isVertical) increase() }
Keys.onRightPressed: { if (!contents.isVertical) decrease() }
function accessibleIncreaseAction() { increase() }
function accessibleDecreaseAction() { decrease() }
function increase() {
if (!enabled)
return; return;
if (inverted)
value -= stepSize;
else
value += stepSize;
}
Keys.onDownPressed: {
if (!enabled || !enabled)
return;
if (!contents.isVertical)
return;
if (inverted) if (inverted)
value += stepSize; value += stepSize;
else else
value -= stepSize; value -= stepSize;
} }
function decrease() {
Keys.onLeftPressed: { if (!enabled)
if (!enabled || contents.isVertical)
return; return;
if (inverted)
value += stepSize;
else
value -= stepSize;
}
Keys.onRightPressed: {
if (!enabled || contents.isVertical)
return;
if (inverted) if (inverted)
value -= stepSize; value -= stepSize;
else else
@ -327,4 +308,5 @@ Item {
property: "x" property: "x"
value: range.position value: range.position
} }
Accessible.role: Accessible.Slider
} }

View File

@ -63,4 +63,5 @@ Private.DualStateButton {
} }
shadow: Private.ButtonShadow {} shadow: Private.ButtonShadow {}
Accessible.role: Accessible.CheckBox
} }

View File

@ -82,6 +82,8 @@ FocusScope {
implicitWidth: layout.implicitWidth implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight implicitHeight: layout.implicitHeight
Accessible.role: Accessible.PageTabList
Item { Item {
id: buttonCutter id: buttonCutter
anchors { anchors {

View File

@ -87,6 +87,11 @@ Item {
*/ */
signal clicked signal clicked
Accessible.role: Accessible.PageTab
Accessible.checkable: true
Accessible.checked: checked
Accessible.name: text
implicitWidth: Math.max(label.implicitWidth + (internal.portrait ? 0 : (iconSource != null ? units.iconSizes.small : 0)), height) implicitWidth: Math.max(label.implicitWidth + (internal.portrait ? 0 : (iconSource != null ? units.iconSizes.small : 0)), height)
implicitHeight: 20//label.implicitHeight + (internal.portrait ? (iconSource != null ? units.iconSizes.small : 0) : 0) implicitHeight: 20//label.implicitHeight + (internal.portrait ? (iconSource != null ? units.iconSizes.small : 0) : 0)

View File

@ -437,4 +437,7 @@ Item {
orientation: Qt.Vertical orientation: Qt.Vertical
stepSize: textEdit.font.pixelSize stepSize: textEdit.font.pixelSize
} }
Accessible.role: EditableText
Accessible.readOnly: readOnly
} }

View File

@ -384,4 +384,10 @@ FocusScope {
} }
} }
} }
Accessible.name: text
Accessible.role: EditableText
Accessible.readOnly: readOnly
Accessible.passwordEdit: echoMode == TextInput.Password || echoMode === TextInput.PasswordEchoOnEdit
Accessible.description: placeholderText
} }

View File

@ -239,4 +239,6 @@ Item{
} }
} }
} }
Accessible.role: Accessible.ToolBar
} }

View File

@ -434,5 +434,12 @@ Item {
onTriggered: Tooltip.showText(mouse, Qt.point(mouse.mouseX, mouse.mouseY), tooltip) onTriggered: Tooltip.showText(mouse, Qt.point(mouse.mouseX, mouse.mouseY), tooltip)
} }
} }
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: tooltip
function accessiblePressAction() {
internal.clickButton()
}
} }

View File

@ -112,7 +112,14 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onReleased: dualButton.released();
onPressed: dualButton.forceActiveFocus(); onPressed: dualButton.forceActiveFocus();
onReleased: dualButton.released();
}
Accessible.name: text
Accessible.checkable: checkable
Accessible.checked: checked
function accessiblePressAction() {
dualButton.forceActiveFocus()
dualButton.released()
} }
} }