Results 1 to 4 of 4

Thread: QTextDocument printing - specify font size?

  1. #1
    Join Date
    Feb 2007
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QTextDocument printing - specify font size?

    No matter what I try, I cannot modify the base font size from the programmed defaults. What is the proper way given:

    Qt Code:
    1. QTextDocument document;
    2. QString allText=QString("<html>"+appointmentSheet+"</html>")
    3. .arg("1")
    4. .arg("2")
    5. .arg("3")
    6. .arg("4");
    7. //1
    8. document.setHtml(allText);
    9. //2
    10. document.print(&printer);
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextDocument printing - specify font size?


  3. #3
    Join Date
    Feb 2007
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextDocument printing - specify font size?

    Quote Originally Posted by wysota View Post

    No dice. I added:
    Qt Code:
    1. document.setDefaultStyleSheet("* {font-size: 24}");
    To copy to clipboard, switch view to plain text mode 

    I also tried variations (*=body, p, no selector and no{ }, etc). Is my style sheet syntax wrong?
    Last edited by Scorp1us; 1st March 2007 at 15:02.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextDocument printing - specify font size?

    I don't think this is enough, but let's now assume it is. When did you apply the stylesheet?

Similar Threads

  1. Replies: 3
    Last Post: 30th January 2007, 07:35
  2. QTextDocument - color, font
    By kemp in forum Qt Programming
    Replies: 6
    Last Post: 24th January 2007, 13:51
  3. QTreeView font size not being set
    By forrestfsu in forum Qt Tools
    Replies: 2
    Last Post: 12th October 2006, 13:53
  4. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  5. Replies: 0
    Last Post: 28th June 2006, 20:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.