scale widget-based app
-
wrote on 7 Mar 2016, 15:56 last edited by m_andrej 3 Jul 2016, 16:00
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.
-
Hi,
What kind of application is it ?
-
wrote on 8 Mar 2016, 08:02 last edited by
It's application for recording passing times of participants in a sports tournament.
-
wrote on 10 Mar 2016, 09:41 last edited byThis post is deleted!
-
@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_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. ? -
@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.
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 ? -
wrote on 14 Mar 2016, 12:18 last edited by m_andrej
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.
-
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. -
wrote on 17 Mar 2016, 11:41 last edited by
I did it with stylesheets like this:
QPushButton { min-height: 40px }
-
@m_andrej
Ok. very simple then. :)
1/11