Results 1 to 3 of 3

Thread: Printing from a textEdit

  1. #1
    Join Date
    Sep 2009
    Posts
    34
    Thanks
    28
    Qt products
    Qt4
    Platforms
    MacOS X

    Question Printing from a textEdit

    Hi guys,

    I was wondering how to print from a QTextEdit. Please don't send me any links to trolltech documentation. I have read it and I have found it to be confusing (at least to me).

    Any code samples would be appreciated.

    Thanks in advance,

    Nefastious :P

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Printing from a textEdit

    Qt Code:
    1. QPrinter printer(QPrinter::HighResolution);
    2. printer.setOutputFileName("print.ps");
    3. QPainter painter;
    4. painter.begin(&printer);
    5. painter.drawText(painter.pageRect(), YourQStringHere);
    6. painter.end();
    To copy to clipboard, switch view to plain text mode 

    Please don't send me any links to trolltech documentation. I have read it and I have found it to be confusing (at least to me).
    Then you should probably learn C++ first since the documentations is the best out there for a c++ framework. And if you don't understand that reference you lacking to much object orientated knowledge to combine the documentations of QPrinter and QPainter...

  3. The following user says thank you to Lykurg for this useful post:

    Nefastious (19th October 2009)

  4. #3
    Join Date
    Oct 2009
    Location
    tathra nsw australia
    Posts
    14
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Printing from a textEdit

    under ui->setupUi(this);
    printer = new QPrinter;

    then
    textEdit->print(printer)

Similar Threads

  1. Help text color in TextEdit
    By tho97 in forum Qt Programming
    Replies: 5
    Last Post: 26th March 2008, 08:47
  2. Printing problem in windows
    By joseph in forum Qt Programming
    Replies: 6
    Last Post: 12th July 2007, 08:04
  3. Make the cursor visible in textEdit (Qt3.3.5)
    By vermarajeev in forum Qt Programming
    Replies: 9
    Last Post: 24th January 2007, 22:50
  4. Replies: 0
    Last Post: 28th June 2006, 20:49
  5. visible text of textedit
    By regix in forum Qt Programming
    Replies: 3
    Last Post: 26th June 2006, 09:02

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.