Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QPushButton does not export enabled accessbility property on macOS (5.15.5 LTS)



  • Hi,

    We are looking to move from our current Qt version (5.12.11) to the latest Qt5 LTS of 5.15.5

    The problem we have is that we have an extensive system integration test suite for our product on macOS, and the majority of our tests interacting with dialogs are currently failing because we cannot determine whether QPushButtons (mostly buttons residing inside a QDialogButtonBox) are enabled/disabled appropriately.

    Our implementation to test this is using the standard accessibility APIs provided by the Application Services framework on macOS.

    We can find and interact with the button, but a query for the property kAXEnabledAttribute fails.

    I put together a basic standalone Qt app to show a basic window with a QPushButton on it, the label for the button is "Start Watching". I then modified our automation tool to find the button and print all of the available attributes and their values.

    When I compile my sample app with Qt 5.12.11 I get the following output, note the presence of AXEnabled

    {
        AXChildren = "(\n)";
        AXDescription = "Start Watching";
        AXEnabled = 1;
        AXFocused = 0;
        AXFrame = "<AXValue 0x7f8462f04960> {value = x:1050.000000 y:566.000000 w:113.000000 h:32.000000 type = kAXValueCGRectType}";
        AXParent = "<AXUIElement 0x7f8462d078f0> {pid=44727}";
        AXPosition = "<AXValue 0x7f8462f04ec0> {value = x:1050.000000 y:566.000000 type = kAXValueCGPointType}";
        AXRole = AXButton;
        AXRoleDescription = button;
        AXSize = "<AXValue 0x7f8462c108d0> {value = w:113.000000 h:32.000000 type = kAXValueCGSizeType}";
        AXTitle = "Start Watching";
        AXTopLevelUIElement = "<AXUIElement 0x7f8462c108d0> {pid=44727}";
        AXWindow = "<AXUIElement 0x7f8462d08430> {pid=44727}";
    }
    

    When compiling against Qt 5.15.5, I get the following, note that AXEnabled is not present

    {
        AXChildren = "(\n)";
        AXDescription = "Start Watching";
        AXFocused = 0;
        AXFrame = "<AXValue 0x7f96d6c10cd0> {value = x:1050.000000 y:566.000000 w:113.000000 h:32.000000 type = kAXValueCGRectType}";
        AXInsertionPointLineNumber = 0;
        AXNumberOfCharacters = 0;
        AXParent = "<AXUIElement 0x7f96d6d08aa0> {pid=43528}";
        AXPosition = "<AXValue 0x7f96d6d08aa0> {value = x:1050.000000 y:566.000000 type = kAXValueCGPointType}";
        AXRole = AXButton;
        AXRoleDescription = button;
        AXSelectedTextRange = "<AXValue 0x7f96d6c10250> {value = location:0 length:0 type = kAXValueCFRangeType}";
        AXSize = "<AXValue 0x7f96d6d08aa0> {value = w:113.000000 h:32.000000 type = kAXValueCGSizeType}";
        AXTitle = "Start Watching";
        AXVisibleCharacterRange = "<AXValue 0x7f96d6c10f10> {value = location:0 length:14 type = kAXValueCFRangeType}";
    }
    

    Does anybody know if there has been a breaking change for QPushButton accessibility between 5.12 and 5.15 which I need to make code changes to maintain behaviour, or should I raise this as a bug?

    Thanks in advance for any advise/assistance anyone can provide :)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Intriguing situation ! Since you are using Qt 5.15.5, this means that you have a commercial licence. You should contact the Qt Company directly.

    One thing you can check is the bug report system to see if has already been reported.



  • Thanks @SGaist , I did spend a while scouring the bug report system and didn't find anything... I was hoping that it was simply something changed in Qt that I need to accommodate with code changes, rather than it being a bug :(



  • Just in case anybody else finds this post while looking for the same/similar issue, I've opened a bug here https://bugreports.qt.io/browse/QTBUG-95029


  • Lifetime Qt Champion

    Thanks for the report !

    Can you upload there the minimal application you use to show the difference ?

    That will help pinpoint the problem.



  • @SGaist Do you mean the sample Qt app, or my swift app I use to inspect the accessibility elements?


  • Lifetime Qt Champion

    I think both could be helpful.



  • @SGaist ok, I've added those to the bug


  • Lifetime Qt Champion

    Thanks !


Log in to reply