PDA

View Full Version : Restrict Win display text size appearance?



grantbj74
7th August 2013, 06:39
Hi,

In Windows 7 (and others) you can set the display text size appearance to Smaller(default), Medium and Larger.

I've written my application to suit Smaller appearance. If a user changes to Larger appearance, most buttons, checkboxes etc text don't fit.

Is there a way to make the text fit the same for all display text size appearances?

I have tried collecting the following for larger and smaller:



spinbox1->setValue( QApplication::font().pointSize() ); // result was 8 for Smaller and Larger.
spinbox2->setValue( QApplication::font().pixelSize() ); // result was -1 for Smaller and Larger.


Both gave the same results :(

Thanks in advance
Brendan

karankumar1609
7th August 2013, 06:49
You can use the setFont method of QApplication in main function.



set your own font
// QApplication::setFont(const QFont & font, const char * className = 0);

grantbj74
7th August 2013, 07:36
Unfortunately that didn't work for me.

This is what I tried:


QFont newFont("MS Shell Dlg 2", 10, QFont::Normal, false);
QApplication::setFont(newFont);


Ok for smaller, text too big in larger mode.

ChrisW67
7th August 2013, 08:18
The Qt layout system should be adjusting to suit. If you have fixed the size of UI elements (or are not using the layout system) then there is nothing the Qt layout system can do to accommodate the increased size. Can you show a small, self-contained example code and the on-screen result?

grantbj74
7th August 2013, 08:38
Thanks,

I do remember the form size and position, so thats probably the problem then.

I wonder if there is a simple way of knowing which mode is selected?

The only thing I can think is checking the text width.