Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Quick Application font size increased when run as super user in Ubuntu
QtWS25 Last Chance

Qt Quick Application font size increased when run as super user in Ubuntu

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
9 Posts 3 Posters 820 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.
  • M Offline
    M Offline
    martiny
    wrote on last edited by
    #1

    Hi Everyone,

    I have developed one Qt Quick Application and it's working fine when I am running as normal user.
    But, same code is increasing the font size when I am running as super user.
    What should be the reason for this changes?

    Is anyone faced same kind of issue?

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

      Hi and welcome to devnet,

      Are you using sudo to run your application as super user ?

      I remember from old time that there where some distributions that had some clear visual changes when running something as a super user so you would take extra care before doing something that would break your machine.

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

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Are you using sudo to run your application as super user ?

        I remember from old time that there where some distributions that had some clear visual changes when running something as a super user so you would take extra care before doing something that would break your machine.

        M Offline
        M Offline
        martiny
        wrote on last edited by
        #3

        @SGaist Yes, I am using sudo to run your application as super user.
        Then how to prevent the changes in super user. Because, I have to run my application in super user mode only.
        It changes approx 5 to 10 font size and result is so ugly.

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          Are you explicitly setting the font size? I am guessing root is not setup with defaults like a normal user would have. root is not running the xsession so nothing was ever setup for root user.

          I don't think its a good idea to run the whole app as root. You should be looking at elevating privileges for the tasks your program runs. One way is to spin off tasks using QProcess. There might be other ways. The maintenance tool from Qt does this.

          C++ is a perfectly valid school of magic.

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

            @fcarney is correct here, you should cleanly separate what root shall do and the GUI. Take for example the settings. You can freely change things and for stuff like system clock, you will get a dialog asking for a super user password in order to alter the system.

            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
            • fcarneyF fcarney

              Are you explicitly setting the font size? I am guessing root is not setup with defaults like a normal user would have. root is not running the xsession so nothing was ever setup for root user.

              I don't think its a good idea to run the whole app as root. You should be looking at elevating privileges for the tasks your program runs. One way is to spin off tasks using QProcess. There might be other ways. The maintenance tool from Qt does this.

              M Offline
              M Offline
              martiny
              wrote on last edited by martiny
              #6

              @fcarney Hi fcarney, thanks for commenting.
              @SGaist
              In qml file, I have mentioned like this "font.pointSize: 24" in my text.

              In my project, I have other applications also (other than QT application). For that I have to run my entire project in root mode only.
              For this case, what can I do for that font issue?

              fcarneyF 1 Reply Last reply
              0
              • M martiny

                @fcarney Hi fcarney, thanks for commenting.
                @SGaist
                In qml file, I have mentioned like this "font.pointSize: 24" in my text.

                In my project, I have other applications also (other than QT application). For that I have to run my entire project in root mode only.
                For this case, what can I do for that font issue?

                fcarneyF Offline
                fcarneyF Offline
                fcarney
                wrote on last edited by
                #7

                @martiny said in Qt Quick Application font size increased when run as super user in Ubuntu:

                For this case, what can I do for that font issue?

                Also, is the font the same as regular user?
                Try setting a specific font and see if that helps. Also, check DPI for both user types. This could be messing things up. You could also go with fonts being set to pixel size and see if this helps.
                I am not sure how hard this would be, but maybe check out the settings for root vs user. And set settings on root to be a known set of values for window manager / xsession.

                C++ is a perfectly valid school of magic.

                1 Reply Last reply
                0
                • fcarneyF Offline
                  fcarneyF Offline
                  fcarney
                  wrote on last edited by
                  #8

                  Can you log into an xsession as root so it sets up the user?

                  C++ is a perfectly valid school of magic.

                  M 1 Reply Last reply
                  0
                  • fcarneyF fcarney

                    Can you log into an xsession as root so it sets up the user?

                    M Offline
                    M Offline
                    martiny
                    wrote on last edited by
                    #9

                    @fcarney Hi Fcarney, sorry for delay.
                    I have not using any specific fonts. I have tried default theme and font matching between normal user and root user. But, there is no changes.(
                    And also I tried Qt examples even in that examples i'm facing same issue. I didn't change anything on the example code.

                    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