Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved Fixed form text size, independant from os

    General and Desktop
    2
    9
    2887
    Loading More Posts
    • 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
      Q139 last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 2
        • Q
          Q139 last edited by

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

          1 Reply Last reply Reply Quote 0
          • Q
            Q139 last edited by Q139

            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 Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              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 Reply Quote 1
              • Q
                Q139 @SGaist last edited by Q139

                @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 Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  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 Reply Quote 1
                  • Q
                    Q139 @SGaist last edited by

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

                    1 Reply Last reply Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      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 Reply Quote 1
                      • First post
                        Last post