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. How to automatically resize all widgets when Display DPI scale is changed
Forum Updated to NodeBB v4.3 + New Features

How to automatically resize all widgets when Display DPI scale is changed

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 680 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.
  • M Offline
    M Offline
    mhmdkanj
    wrote on last edited by
    #1

    On Windows, in the display settings I could change the size of the contents of the screen in %.
    Now, if the display settings were updated BEFORE launching the GUI, the GUI would look fine.
    However, if the display settings were updated WHILE the GUI is open, then all fonts would increase (as expected) in size but the widgets such as push buttons and others would stay the same size (unlike in the previous scenario).

    So after some research and thinking, it might make sense to use:

    1. QScreen::logicalDotsPerInchChanged signal to signal that display settings were changed.
    2. Upon receiving this signal, the whole ui window should update all of its widgets to match this new scale % factor.

    Btw, this question was asked and solved before; however, without showing some implementation as in : here

    So my question resides in how can this be implemented:

    • For number 1: where do I place this signal connection and how can I react to it
    • For number 2: what is a good way to resize or update widgets without doing so one by one, but rather at the ui window level.
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      In fact, there was no solution and the original poster did not provide a link to the relevant mailing list thread.

      Which version of Qt are you using ?

      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
      0
      • M Offline
        M Offline
        mhmdkanj
        wrote on last edited by
        #3

        @SGaist Hi, I'm using v5.13.1 on Windows with msvc build.

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

          Then you should try a more recent version. IIRC there has been some work on that field.

          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
          0

          • Login

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