Skip to content

Commit

Permalink
Add QAccessibleHyperlinkInterface
Browse files Browse the repository at this point in the history
This is needed in order to support hyperlinks in text content.

Task-number: QTBUG-67878
Change-Id: I1e990a5db8f0cf78e5cdcec7359e5aabffe42e3d
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
Jan Arve Sæther committed Jun 3, 2021
1 parent f00c630 commit 491ea14
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
39 changes: 39 additions & 0 deletions src/gui/accessible/qaccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\omitvalue ImageInterface \omit For objects that represent an image. This interface is generally less important. \endomit
\value TableInterface For lists, tables and trees.
\value TableCellInterface For cells in a TableInterface object.
\value HyperlinkInterface For hyperlink nodes (usually embedded as children of text nodes)
\sa QAccessibleInterface::interface_cast(), QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
*/
Expand Down Expand Up @@ -2958,6 +2959,44 @@ QString qAccessibleLocalizedActionDescription(const QString &actionName)
return accessibleActionStrings()->localizedDescription(actionName);
}

/*!
\internal
\fn QString QAccessibleHyperlinkInterface::anchor() const
The logical/human readable name of the hyperlink
*/

/*!
\internal
\fn QString QAccessibleHyperlinkInterface::anchorTarget() const
The target url of the hyperlink
*/

/*!
\internal
\fn int QAccessibleHyperlinkInterface::startIndex() const
Returns the start index that will refer to the first character in the text where the hyperlink
begins. The index corresponds to the index that the QAccessibleTextInterface needs in order
to find the start of the hyperlink.
*/

/*!
\internal
\fn int QAccessibleHyperlinkInterface::endIndex() const
Returns the end index that will refer to the first character in the text where the hyperlink
begins. The index corresponds to the index that the QAccessibleTextInterface needs in order
to find the end of the hyperlink.
*/

QAccessibleHyperlinkInterface::~QAccessibleHyperlinkInterface()
{

}

#endif // QT_NO_ACCESSIBILITY

QT_END_NAMESPACE
Expand Down
18 changes: 17 additions & 1 deletion src/gui/accessible/qaccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ class Q_GUI_EXPORT QAccessible
ActionInterface,
ImageInterface,
TableInterface,
TableCellInterface
TableCellInterface,
HyperlinkInterface
};

enum TextBoundaryType {
Expand Down Expand Up @@ -451,6 +452,7 @@ class QAccessibleActionInterface;
class QAccessibleImageInterface;
class QAccessibleTableInterface;
class QAccessibleTableCellInterface;
class QAccessibleHyperlinkInterface;
class QAccessibleTableModelChangeEvent;

class Q_GUI_EXPORT QAccessibleInterface
Expand Down Expand Up @@ -508,6 +510,9 @@ class Q_GUI_EXPORT QAccessibleInterface
inline QAccessibleTableCellInterface *tableCellInterface()
{ return reinterpret_cast<QAccessibleTableCellInterface *>(interface_cast(QAccessible::TableCellInterface)); }

inline QAccessibleHyperlinkInterface *hyperlinkInterface()
{ return reinterpret_cast<QAccessibleHyperlinkInterface *>(interface_cast(QAccessible::HyperlinkInterface)); }

virtual void virtual_hook(int id, void *data);

virtual void *interface_cast(QAccessible::InterfaceType)
Expand Down Expand Up @@ -659,6 +664,17 @@ class Q_GUI_EXPORT QAccessibleImageInterface
virtual QPoint imagePosition() const = 0;
};

class Q_GUI_EXPORT QAccessibleHyperlinkInterface
{
public:
virtual ~QAccessibleHyperlinkInterface();

virtual QString anchor() const = 0;
virtual QString anchorTarget() const = 0;
virtual int startIndex() const = 0;
virtual int endIndex() const = 0;
virtual bool isValid() const = 0;
};

class Q_GUI_EXPORT QAccessibleEvent
{
Expand Down

0 comments on commit 491ea14

Please sign in to comment.