Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Create accessible applications with Qt
Forum Updated to NodeBB v4.3 + New Features

Create accessible applications with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PythonQTMarlem
    wrote on last edited by
    #1

    Hi,

    in a tutorial video I saw that Qt surface components
    have the properties "AccessibleName" and "AccessibleDescription".
    This suggests that Qt applications are screen readable
    can be developed. In the programming languages ​​are called Java and C #
    the properties the same.
    I am developing Python on Windows 10

    Question:
    Is there a guide on how to make a Python Qt application suitable for screen readers?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      I don't know about this but maybe you can refer to the doc:
      https://doc.qt.io/qt-5/accessible-qwidget.html

      1 Reply Last reply
      2
      • P Offline
        P Offline
        PythonQTMarlem
        wrote on last edited by
        #3

        Thank you! But unfortunately I couldn't find anything about screen readers in the examples.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on last edited by
          #4

          Ah, also this doc: https://doc.qt.io/qt-5/accessible.html

          Applications do not usually communicate directly with the assistive tools, but through a platform specific API. Generally the communication with the ATs works though an IPC mechanism. Semantic information about user interface elements, such as buttons and scroll bars, is exposed to the assistive technologies. Qt supports UI Automation on Windows, macOS Accessibility on macOS, and AT-SPI via DBus on Unix/X11. The platform specific technologies are abstracted by Qt, so that applications do not need any platform specific changes to work with the different native APIs. Qt tries to make adding accessibility support to your application as easy as possible, only a few changes from your side may be required to allow even more users to enjoy it.

          From that I can get that Qt does not provide screen readers itself, but it supports platform specific assistive technologies.
          So the screen reader of the platform should be turned on first. Then you can try the example.
          Sorry, this is as far as I can understand...

          1 Reply Last reply
          1
          • P Offline
            P Offline
            PythonQTMarlem
            wrote on last edited by PythonQTMarlem
            #5

            Okay. Maybe you can give an example. Windows 10.

            I have a QPushButton:

            button = QPushButton ('TestSchalter', window)
            button.move (50, 50)
            

            I would like to add a text to this QPushButton, which is read out by the screen reader http://nvda.bhvd.de/.
            What do I have to do?

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Bonnie
              wrote on last edited by
              #6

              According to the doc I posted above, Qt only supports UI Automation on Windows.
              And as I said, I don't know anything about accessibility, so I can't help you further.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                PythonQTMarlem
                wrote on last edited by
                #7

                okay, last try:
                I found the following directory on my hard drive:

                C: \ PythonQt \ Examples \ Qt-5.14.2 \ quick \ quick-accessibility

                Has anyone else besides me and can tell me what it's about?

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  PythonQTMarlem
                  wrote on last edited by
                  #8

                  Hi,

                  the reason I'm mistaken is that there is a bug on Windows. I still have to set whether the bug with Qt or the screen reader is NVDA.

                  The following code works under Ubuntu 20.04 with the screen reader Orca, which can be found in Ubuntu in the access aids:

                  #!/usr/bin/env python3
                  import sys
                  from PyQt5 import QtCore, QtWidgets
                  from PyQt5.QtWidgets import *
                  from PyQt5.QtCore import QSize
                  
                  class MyWindow(QMainWindow):
                      def __init__(self):
                          # Konstruktor von QMainWindow aufrufen
                          super().__init__()
                  
                          # Fenstergröße und Titel einstellen
                          self.setMinimumSize(QSize(300, 100))
                          self.setWindowTitle('Barrierefreiheit mit Qt')
                  
                          def sag_HalloWindows():
                              print("Hallo Windows!")
                  
                          def sag_HalloUbuntu():
                              print("Hallo Ubuntu!")
                  
                          vButtonWindows = QPushButton("Hallo Windows",self)
                          vButtonWindows.setGeometry(0,0,80,30)
                          vButtonWindows.setAccessibleDescription("Es wird ein Hallo Windows auf der Console ausgeben")
                          vButtonWindows.clicked.connect(sag_HalloWindows)
                          vButtonWindows.show()
                  
                          vButtonUbuntu = QPushButton("Hallo Ubuntu!",self)
                          vButtonUbuntu.setGeometry(0, 50,80,30)
                          vButtonUbuntu.setAccessibleDescription("Es wird ein Hallo Ubuntu auf der Console ausgeben")
                          vButtonUbuntu.clicked.connect(sag_HalloUbuntu)
                          vButtonUbuntu.show()
                  
                  app = QtWidgets.QApplication([])
                  win = MyWindow()
                  win.show()
                  app.exec_()
                  

                  Folgender Code funktioniert unter Windows 10 mit dem kostenlosen Screenreader http://nvda.bhvd.de/

                  #!/usr/bin/env python3
                  import sys
                  from PyQt5 import QtCore, QtWidgets
                  from PyQt5.QtWidgets import *
                  from PyQt5.QtCore import QSize
                  
                  class MyWindow(QMainWindow):
                      def __init__(self):
                          # Konstruktor von QMainWindow aufrufen
                          super().__init__()
                  
                          # Fenstergröße und Titel einstellen
                          self.setMinimumSize(QSize(300, 100))
                          self.setWindowTitle('Barrierefreiheit mit Qt')
                  
                          def sag_HalloWindows():
                              print("Hallo Windows!")
                  
                          def sag_HalloUbuntu():
                              print("Hallo Ubuntu!")
                  
                          vButtonWindows = QPushButton("Hallo Windows",self)
                          vButtonWindows.setGeometry(0,0,80,30)
                          vButtonWindows.setAccessibleName("Es wird ein Hallo Windows auf der Console ausgeben")
                          vButtonWindows.clicked.connect(sag_HalloWindows)
                          vButtonWindows.show()
                  
                          vButtonUbuntu = QPushButton("Hallo Ubuntu!",self)
                          vButtonUbuntu.setGeometry(0, 50,80,30)
                          vButtonUbuntu.setAccessibleName("Es wird ein Hallo Ubuntu auf der Console ausgeben")
                          vButtonUbuntu.clicked.connect(sag_HalloUbuntu)
                          vButtonUbuntu.show()
                  
                  app = QtWidgets.QApplication([])
                  win = MyWindow()
                  win.show()
                  app.exec_()
                  

                  Does anyone have any other ideas how I can find out what goes wrong with Windows 10?

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    PythonQTMarlem
                    wrote on last edited by
                    #9

                    Now I know how to do it. I tested it on Windows, Ubuntu and MacOS:
                    self.comboschriftart.setAccessibleName("Auswahlliste um Schriftart festzulegen")
                    self.comboschriftgroesse.setAccessibleName("Auswahlliste um Schriftartgrad festzulegen")
                    The screenreaders Jaws, NVDA, Orca and Voice Over reads the property "AccessibleName" .They don't read the property "AccessibleDescription".

                    1 Reply Last reply
                    1

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved