PDA

View Full Version : change font size and button size of QMessageBox



nass
12th September 2006, 14:54
Hello everyone,
i am wondering if there is an easy way to change the size of fonts and of QMessageBox button. I am gonna be running the GUI in a rather small screen and need to make these bigger. Is it possible in an easy wawy or the only way is to make a msgBox class on my own?
thank you nass

jacek
12th September 2006, 14:58
You could try QApplication::setFont().

nass
13th September 2006, 10:14
no that wouldn't do it... the rest of the application has set font's and stuff... i only want to change the messageBox's font and button sizes...

nass
13th September 2006, 10:16
someone mentioned smth about
using html tags in my message..
but didn't go into detail... what is it i could do?

sunil.thaha
13th September 2006, 10:50
Exactly ;)

Try this


QMessabeBox::information( 0, "Title" , "<font size = 10 color = red > Hello World </font> " );

Chicken Blood Machine
13th September 2006, 19:17
Exactly ;)

Try this


QMessabeBox::information( 0, "Title" , "<font size = 10 color = red > Hello World </font> " );


That will work for the message text, but you will have to either subclass QMessageBox in order to change the button font size, or call setFont() on a QMessageBox widget.

jpn
13th September 2006, 20:16
One option to access the buttons (to modify their sizes) is to create an instance of QMessageBox (instead of using convenient static methods) and then use QObject::findChildren() to find the buttons.