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. scale widget-based app

scale widget-based app

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 2.1k 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
    m_andrej
    wrote on last edited by m_andrej
    #1

    I have a widget-based desktop application, on which I need to make all items larger, because user will be somewhat further from computer screen. Is there a way to do this?

    I searched the Internet and found that widgets scale themselves according to QScreen::devicePixelRatio(). However, I couldn't find out how to override its return value.

    I'm using Qt 5.5.1.

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

      Hi,

      What kind of application is it ?

      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
        m_andrej
        wrote on last edited by
        #3

        It's application for recording passing times of participants in a sports tournament.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          m_andrej
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @m_andrej said:

            QScreen::devicePixelRatio()

            Im not sure u can override it as such.

            Its meant for support for higher res
            screen which will be better supported in Qt 5.6.

            Your use case sounds like you want to have a design where
            all MUCH bigger than it normally would. ?

            M 1 Reply Last reply
            2
            • mrjjM mrjj

              @m_andrej said:

              QScreen::devicePixelRatio()

              Im not sure u can override it as such.

              Its meant for support for higher res
              screen which will be better supported in Qt 5.6.

              Your use case sounds like you want to have a design where
              all MUCH bigger than it normally would. ?

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

              @mrjj said:

              Your use case sounds like you want to have a design where
              all MUCH bigger than it normally would. ?

              I don't understand your question.

              mrjjM 1 Reply Last reply
              0
              • M m_andrej

                @mrjj said:

                Your use case sounds like you want to have a design where
                all MUCH bigger than it normally would. ?

                I don't understand your question.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                ok. sorry if unclear.

                Normally QScreen::devicePixelRatio() is used to scale the size of buttons etc
                so on high res screens they do not become way to small.

                It sounds to me that you are looking for a solution to scale whole GUI so its
                much bigger than a normal desktop app would have it so they can be seen
                from further away ?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  m_andrej
                  wrote on last edited by m_andrej
                  #8

                  Yes, I want to make the whole GUI approximately twice as big. Not just text, but also buttons etc.

                  If QScreen::devicePixelRatio() isn't the way to go, is it possible to adjust the size of controls by using Qt Style Sheets?

                  My UI isn't so rich, contains just a couple of repeating widgets (buttons, tab bar, line edits), so I could just add some code to style sheet for each control type.

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

                    Ok. i understand.

                    Have you used layouts for the GUI?
                    So it already scales to mainwindow?

                    Also, must it support many different screen sizes/resolution or
                    you know before hand what the target screen will be ?

                    I think style sheet could work. However some controls might change the look when
                    you apply style sheet.

                    Could u show an image of the interface?
                    maybe a easy way was just to travel all Widgets and scale by some factor.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      m_andrej
                      wrote on last edited by
                      #10

                      I did it with stylesheets like this:

                      QPushButton { 
                      min-height: 40px
                      }
                      
                      mrjjM 1 Reply Last reply
                      0
                      • M m_andrej

                        I did it with stylesheets like this:

                        QPushButton { 
                        min-height: 40px
                        }
                        
                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @m_andrej
                        Ok. very simple then. :)

                        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