Results 1 to 3 of 3

Thread: Change margin on QTextEdit print()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: Change margin on QTextEdit print()

    Take http://doc.trolltech.com/4.1/qtextdocument.html from qtextedit

    xdoc = edit->document();

    and send this to dialog;
    http://www.qt-apps.org/content/show....?content=62383

    Qt Code:
    1. TextPrinter *textprinter_ = new TextPrinter(this);
    2. textprinter_->setHeaderSize(0);
    3. textprinter_->setLeftMargin(12);
    4. textprinter_->setRightMargin(10);
    5. textprinter_->setHeaderText(tr("Foo date %1").arg(QDateTime::currentDateTime().toString()));
    6. textprinter_->preview(xdoc, tr("Preview xx"));
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to patrik08 for this useful post:

    gordebak (25th May 2010)

  3. #2
    Join Date
    Mar 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Change margin on QTextEdit print()

    I just found out that the new version of Qt (4.4.0) contains some improvements regarding the margin handling:

    "Made a number of improvements to printing in Qt 4.4, including support for setting custom page sizes and custom margins ... "

    Textprinter is also fine...

    Thank you for your help!

Similar Threads

  1. Replies: 2
    Last Post: 9th March 2007, 23:19

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
  •  
Qt is a trademark of The Qt Company.