Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. What is the best method to set a font size if you want the Qt software to be easy to use for people with visual impairments?
Qt 6.11 is out! See what's new in the release blog

What is the best method to set a font size if you want the Qt software to be easy to use for people with visual impairments?

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 3 Posters 998 Views 1 Watching
  • 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

    Hello,
    I program accessible software with Python and Qt.
    I found the following 2 ways to set the font size:

    window.setStyleSheet('font-size: 30px')
    

    And

    font = QFont()
    font.setPointSize(20) # Set font size to 2.0rem
    window.setFont(font)
    

    Which option is better?

    JonBJ 1 Reply Last reply
    0
    • P PythonQTMarlem

      Hello,
      I program accessible software with Python and Qt.
      I found the following 2 ways to set the font size:

      window.setStyleSheet('font-size: 30px')
      

      And

      font = QFont()
      font.setPointSize(20) # Set font size to 2.0rem
      window.setFont(font)
      

      Which option is better?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @PythonQTMarlem
      I cannot say about the issue for accessibility. But (unless guides say otherwise) I would always suggest stylesheet as this can be altered at any time, especially if you put your stylesheet rules into external files. I can only imagine that might be useful in your situation. Using QFont will mean the code is compiled with the value of the size, cannot be changed at runtime.

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

        Thank you for your reply.
        Alright, I'll use style sheets. That's fine with me too.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          People with visual impairments usually have their OS adjusted to their issue so I would not hardcode sizes in an application for that purpose as you might do a disservice to the community you want to support.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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