PDA

View Full Version : QTextDocument printing - specify font size?



Scorp1us
28th February 2007, 22:55
No matter what I try, I cannot modify the base font size from the programmed defaults. What is the proper way given:



QTextDocument document;
QString allText=QString("<html>"+appointmentSheet+"</html>")
.arg("1")
.arg("2")
.arg("3")
.arg("4");
//1
document.setHtml(allText);
//2
document.print(&printer);


Calling setDefaultFont() at location #1 or #2 have no effect for me. I've also tried using a textedit and setFontPointSize(). I wish to provide the base font,a nd let the document modify it from there, as it uses relative sizing and other styles.

wysota
1st March 2007, 11:21
How about using QTextDocuemnt::setDefaultStyleSheet()?

Scorp1us
1st March 2007, 14:34
How about using QTextDocuemnt::setDefaultStyleSheet()?


No dice. I added:

document.setDefaultStyleSheet("* {font-size: 24}");

I also tried variations (*=body, p, no selector and no{ }, etc). Is my style sheet syntax wrong?

wysota
1st March 2007, 15:25
I don't think this is enough, but let's now assume it is. When did you apply the stylesheet?