Results 1 to 4 of 4

Thread: printing problem

  1. #1
    Join Date
    Oct 2006
    Posts
    13
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default printing problem

    Hi!
    Tell me please is there any another way to print rich text? -
    In the richtext example there is :
    Qt Code:
    1. void MainWindow::printFile()
    2. {
    3. QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
    4. QTextDocument *document = editor->document();
    5. QPrinter printer;
    6. printer.setOrientation(QPrinter::Landscape);
    7. printer.setFullPage(false);
    8. printer.setPageSize ( QPrinter::A4 );
    9. QPrintDialog *dialog = new QPrintDialog(&printer, this);
    10. dialog->setWindowTitle(tr("Print Document"));
    11. if (dialog->exec() != QDialog::Accepted)
    12. return;
    13. reporter->setWordWrapMode ( QTextOption::WrapAnywhere );
    14. document->print(&printer);
    15. }
    To copy to clipboard, switch view to plain text mode 
    but QTextEdit lost some options - such as editor->setWordWrapMode ( QTextOption::WrapAnywhere ); during printing.

    What to do ?

    Thanks!
    --
    Igor
    Last edited by wysota; 7th November 2006 at 15:11. Reason: missing [code] tags

  2. #2
    Join Date
    Oct 2006
    Posts
    13
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Re: printing problem

    I have found folloving: it happend only in tables, but in simple text all settings work properly.... Maybe someting wrong in my code?

  3. #3
    Join Date
    Oct 2006
    Posts
    13
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: printing problem

    and here is the example of wierd wordwrapping - see attachment pls
    Attached Files Attached Files

  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: printing problem

    The problem is that you are trying to influence the text editor, whereas you are printing the document which is displayed by the editor. Word wrapping is only relevant for rendering the document to the text edit, it won't influence the way the document is printed on the printer. I think you should operate on the QPrinter object directly or on the QTextDocument object which represents the document itself.

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Replies: 0
    Last Post: 28th June 2006, 20:49
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.