5

I've read several articles on this. So I have a Dell XPS 13 and changed the size of text, apps and other items to 200%

enter image description here

But I guess my question is the following. When I launch the application through Qt Designer everything looks good:

enter image description here

enter image description here

But when I run the application outside of the Designer( meaning just double clicking the application to run it), the size is different:

enter image description here

enter image description here This toolbar is actually smaller than what the screenshot shows. So my question is there a setting I can set my application so when I launch it outside of the Designer it will look like when it was launched from the Designer?

adviner
  • 3,295
  • 10
  • 35
  • 64

1 Answers1

1

For certain widget classes you can try to provide size measures relative to its font size with the stylesheet:

pMyWidget->setStyleSheet(
   "MyWidget {"            // What type is it? 
       "min-width: 80em;"  // If the dimension
       "min-height: 40em;" // attribute is
       "width: 160em;"     // applicable
       "height: 80em;"     // to this type.
       // margin:          // See the list
       // padding:         // of related
       // spacing:         // attributes
"}");

That "em" refers to capital "M" font size AFAIR. The tricky part here is what actual MyWidget type is and if you can apply a stylesheet like that. You can probably omit the widget type in style MyWidget {} but leave the contents yet it supposed to modify all the widgets that that one is parenting.

Alexander V
  • 8,351
  • 4
  • 38
  • 47
  • Thanks for the info. I'm wondering though does the Designer do something when it launches the application for it to look different than when launched manually? – adviner Dec 22 '15 at 05:10
  • I don't think so. Maybe if more that one monitor in the system than the one that the app starts on is reflected on default scaling. – Alexander V Dec 22 '15 at 05:26
  • I guess my question is how does the Designer do it when I launch the application after I do a build? Im doing it on my Dell XPS13 notebook on both running on the designer and not and I notice the difference – adviner Dec 22 '15 at 19:01
  • May be you can find a similar issue here https://stackoverflow.com/questions/35714837/how-to-get-sharp-ui-on-high-dpi-with-qt-5-6/60597567#60597567 – Pat. ANDRIA Oct 05 '20 at 07:05