PDA

View Full Version : QFontDialog - How to change the list of the available sizes of the fonts



Placido Currò
20th April 2007, 14:42
Hi,

My application writes texts and draws lines on a QMainDialog and it must respect an area, so the size of the font could be wrong if the user selected an incorrect dimension.

This is why I'd like to change the list of the available sizes of the font the user can select opening the QFontDialog in order to prevent the user to select a size bigger than the cell where the text is written.

I think it's impossible to reimplement this class. Isn't it ? So, I thought that QFontDialog and QFontDatabase can be linked one to the other. My I can't see a link between these two classes.

Have you tried something like this ?

Thank you.

Placido.

marcel
20th April 2007, 15:27
Not really. I don't see any way in which you could remove some size options for a specific font from the QFontDatabase.

Why don't you implement your own font dialog and populate it with the fonts you need. In this case it will also be possible to restrict the size options the user has.

Regards

Placido Currò
20th April 2007, 15:36
Yes, it is easier way to get what I want. I wished a tricky solution.

Thank you.

Placido.