How to resolve HiDPI problem with Qt apps

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












I recently began using the command xrandr --dpi 166 for my new laptop running Ubuntu 16.04.3 64-bit after noticing that otherwise the system automatically uses 96 dpi.



However, such a high dpi setting results in extremely big menus and toolbars only in Qt apps I have, such as Master PDF Editor, digiKam and Krita (the latter two are in AppImage format). Other apps running in Java or WINE environment don't pose such problems.



I'm hoping to find a way of manually entering a specific dpi setting for Qt apps or some other way of resolving this problem.



If there is no way of globally specifying a dpi setting for Qt apps, maybe a simple wrapper script entering xrandr --dpi 96 before and restoring the initial dpi setting after such an app could do as well...










share|improve this question



























    up vote
    1
    down vote

    favorite












    I recently began using the command xrandr --dpi 166 for my new laptop running Ubuntu 16.04.3 64-bit after noticing that otherwise the system automatically uses 96 dpi.



    However, such a high dpi setting results in extremely big menus and toolbars only in Qt apps I have, such as Master PDF Editor, digiKam and Krita (the latter two are in AppImage format). Other apps running in Java or WINE environment don't pose such problems.



    I'm hoping to find a way of manually entering a specific dpi setting for Qt apps or some other way of resolving this problem.



    If there is no way of globally specifying a dpi setting for Qt apps, maybe a simple wrapper script entering xrandr --dpi 96 before and restoring the initial dpi setting after such an app could do as well...










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I recently began using the command xrandr --dpi 166 for my new laptop running Ubuntu 16.04.3 64-bit after noticing that otherwise the system automatically uses 96 dpi.



      However, such a high dpi setting results in extremely big menus and toolbars only in Qt apps I have, such as Master PDF Editor, digiKam and Krita (the latter two are in AppImage format). Other apps running in Java or WINE environment don't pose such problems.



      I'm hoping to find a way of manually entering a specific dpi setting for Qt apps or some other way of resolving this problem.



      If there is no way of globally specifying a dpi setting for Qt apps, maybe a simple wrapper script entering xrandr --dpi 96 before and restoring the initial dpi setting after such an app could do as well...










      share|improve this question















      I recently began using the command xrandr --dpi 166 for my new laptop running Ubuntu 16.04.3 64-bit after noticing that otherwise the system automatically uses 96 dpi.



      However, such a high dpi setting results in extremely big menus and toolbars only in Qt apps I have, such as Master PDF Editor, digiKam and Krita (the latter two are in AppImage format). Other apps running in Java or WINE environment don't pose such problems.



      I'm hoping to find a way of manually entering a specific dpi setting for Qt apps or some other way of resolving this problem.



      If there is no way of globally specifying a dpi setting for Qt apps, maybe a simple wrapper script entering xrandr --dpi 96 before and restoring the initial dpi setting after such an app could do as well...







      qt hdpi






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 10 at 10:08

























      asked Feb 10 at 9:25









      Sadi

      8,56543748




      8,56543748




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          A less than perfect temporary solution that I've found is the following simple wrapper bash script that can be used in the relevant .desktop file instead of the executable of the app in question, e.g. masterpdfeditor4:



          #!/bin/bash
          HiDPI="$(xdpyinfo | grep dots | awk -F'x' 'print $2' | awk -F' ' 'print $1')"
          if [[ ! $HiDPI = 96 ]]
          then
          xrandr --dpi 96
          masterpdfeditor4 "$@"
          xrandr --dpi $HiDPI
          else
          masterpdfeditor4 "$@"
          fi


          This will restore the original dpi setting only if one such app is opened and closed, or in case more than one such app is launched, only if the first app is closed last.



          Secondly, somehow some GUI elements other than menus and toolbars cannot be fixed in this way, e.g. cursor size in Krita workspace...






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1004799%2fhow-to-resolve-hidpi-problem-with-qt-apps%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            A less than perfect temporary solution that I've found is the following simple wrapper bash script that can be used in the relevant .desktop file instead of the executable of the app in question, e.g. masterpdfeditor4:



            #!/bin/bash
            HiDPI="$(xdpyinfo | grep dots | awk -F'x' 'print $2' | awk -F' ' 'print $1')"
            if [[ ! $HiDPI = 96 ]]
            then
            xrandr --dpi 96
            masterpdfeditor4 "$@"
            xrandr --dpi $HiDPI
            else
            masterpdfeditor4 "$@"
            fi


            This will restore the original dpi setting only if one such app is opened and closed, or in case more than one such app is launched, only if the first app is closed last.



            Secondly, somehow some GUI elements other than menus and toolbars cannot be fixed in this way, e.g. cursor size in Krita workspace...






            share|improve this answer
























              up vote
              0
              down vote













              A less than perfect temporary solution that I've found is the following simple wrapper bash script that can be used in the relevant .desktop file instead of the executable of the app in question, e.g. masterpdfeditor4:



              #!/bin/bash
              HiDPI="$(xdpyinfo | grep dots | awk -F'x' 'print $2' | awk -F' ' 'print $1')"
              if [[ ! $HiDPI = 96 ]]
              then
              xrandr --dpi 96
              masterpdfeditor4 "$@"
              xrandr --dpi $HiDPI
              else
              masterpdfeditor4 "$@"
              fi


              This will restore the original dpi setting only if one such app is opened and closed, or in case more than one such app is launched, only if the first app is closed last.



              Secondly, somehow some GUI elements other than menus and toolbars cannot be fixed in this way, e.g. cursor size in Krita workspace...






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                A less than perfect temporary solution that I've found is the following simple wrapper bash script that can be used in the relevant .desktop file instead of the executable of the app in question, e.g. masterpdfeditor4:



                #!/bin/bash
                HiDPI="$(xdpyinfo | grep dots | awk -F'x' 'print $2' | awk -F' ' 'print $1')"
                if [[ ! $HiDPI = 96 ]]
                then
                xrandr --dpi 96
                masterpdfeditor4 "$@"
                xrandr --dpi $HiDPI
                else
                masterpdfeditor4 "$@"
                fi


                This will restore the original dpi setting only if one such app is opened and closed, or in case more than one such app is launched, only if the first app is closed last.



                Secondly, somehow some GUI elements other than menus and toolbars cannot be fixed in this way, e.g. cursor size in Krita workspace...






                share|improve this answer












                A less than perfect temporary solution that I've found is the following simple wrapper bash script that can be used in the relevant .desktop file instead of the executable of the app in question, e.g. masterpdfeditor4:



                #!/bin/bash
                HiDPI="$(xdpyinfo | grep dots | awk -F'x' 'print $2' | awk -F' ' 'print $1')"
                if [[ ! $HiDPI = 96 ]]
                then
                xrandr --dpi 96
                masterpdfeditor4 "$@"
                xrandr --dpi $HiDPI
                else
                masterpdfeditor4 "$@"
                fi


                This will restore the original dpi setting only if one such app is opened and closed, or in case more than one such app is launched, only if the first app is closed last.



                Secondly, somehow some GUI elements other than menus and toolbars cannot be fixed in this way, e.g. cursor size in Krita workspace...







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 10 at 13:37









                Sadi

                8,56543748




                8,56543748



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1004799%2fhow-to-resolve-hidpi-problem-with-qt-apps%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491