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. Fixed form text size, independant from os

Fixed form text size, independant from os

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 3.5k 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.
  • Q Offline
    Q Offline
    Q139
    wrote on last edited by
    #1

    Hi,
    Is it possible to fix sizes of text/other content in qt gui app to fixed size, independant from os setting that can change overall size like 125% 150% etc?

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

      Hi,

      Do you mean going against the OS High DPI settings ?

      You can find more information about Qt's High DPI support here.

      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
      2
      • Q Offline
        Q Offline
        Q139
        wrote on last edited by
        #3

        Yes , to stabilize the app against different os dpi settings.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          Q139
          wrote on last edited by Q139
          #4

          How to:
          setAttribute(Qt::AA_Use96Dpi); to mainwindow?

          MainWin m_win; m_win.setAttribute(Qt::AA_Use96Dpi); Does not work

          QApplication app(argc,argv);
          app.setAttribute(Qt::AA_Use96Dpi);
          

          Also wont notice differene.

          Problem is that the text gets zoomed too big in labels and ui is designed by fixed cordinates for 100% dpi setting , not 125 or 150.

          How to overcome this problem?

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

            It's an application attribute not a widget attribute. You have to set it before creating your QApplication instance using QCoreApplication::setAttribute.

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

            Q 1 Reply Last reply
            1
            • SGaistS SGaist

              It's an application attribute not a widget attribute. You have to set it before creating your QApplication instance using QCoreApplication::setAttribute.

              Q Offline
              Q Offline
              Q139
              wrote on last edited by Q139
              #6

              @SGaist
              Both QApplication and QWidget has the setAttribute and the options avalible.
              The setting has to be modified by the QCoreApplication::setAttribute. and cant modify it seperately for each window or QApplication instance?

              To work against high dpi settings in fixed cordinate designed app by making it small would be better than invisible text, but if possible to implement adjustable zoom for fixed cordinate app, that would allow make overall bigger/smaller would be even better solution.

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

                They both have and both have a different set of attributes. The signature of both function is different. One takes Qt::ApplicationAttribute and the other Qt::WidgetAttribute.

                What is your use of fixed coordinates ?

                The High-DPI scaling should allow your application to show and interact nicely whatever the DPI is.

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

                Q 1 Reply Last reply
                1
                • SGaistS SGaist

                  They both have and both have a different set of attributes. The signature of both function is different. One takes Qt::ApplicationAttribute and the other Qt::WidgetAttribute.

                  What is your use of fixed coordinates ?

                  The High-DPI scaling should allow your application to show and interact nicely whatever the DPI is.

                  Q Offline
                  Q Offline
                  Q139
                  wrote on last edited by
                  #8

                  @SGaist The ui is designed without layouts, with fixed cordinataes and most ui elements quite closely packed.

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

                    Then you have to handle the High DPI stuff yourself also.

                    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