Results 1 to 3 of 3

Thread: Qt 4.4.0 Problem with QPrintPreviewDialog

  1. #1
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Qt 4.4.0 Problem with QPrintPreviewDialog

    I am having a problem with the new QPrintPreviewDialog. The widget will display but the document I am printing will not. The display area is only gray.

    Environment: XP Home SP2 MinGW and Qt 4.4.0 coding in eclipse

    Here is some code snippets. Please help:

    Qt Code:
    1. QPrinter *printer = new QPrinter;
    2. printer->setOutputFormat(QPrinter::NativeFormat);
    3. printer->setPaperSize(QPrinter::Letter);
    4. printer->setOrientation(QPrinter::Landscape);
    5.  
    6. QPrintPreviewDialog *dlg = new QPrintPreviewDialog(printer, this);
    7. connect(dlg, SIGNAL(paintRequested(devPrint)), this, SLOT(slotPrintLog(devPrint)));
    8. dlg->setWindowModality(Qt::ApplicationModal);
    9. dlg->setModal(true);
    10. dlg->setWindowTitle(QString("Session Log Report Preview"));
    11. textEdit->document()->print(printer);
    12. dlg->exec();
    To copy to clipboard, switch view to plain text mode 

    ===== code from slotPrintLog()=====
    Qt Code:
    1. formatReport();
    2. textEdit->print(devPrint);
    To copy to clipboard, switch view to plain text mode 
    ========== code from formatReport()=======
    Qt Code:
    1. // Create the first document cursor
    2. QTextCursor cursor(textEdit->document());
    3. . . . code to print report. . . .
    4. .
    5. .
    6. .
    7. cursor.format. . . and cursor.insertText . . . etc.
    8. textEdit->documentEnd();
    To copy to clipboard, switch view to plain text mode 
    Any ideas?

    There is precious little documentation on this new widget and the dialog. The examples are minimal at best. I need some new ideas.
    Last edited by jpn; 30th May 2008 at 11:41. Reason: missing [code] tags

  2. #2
    Join Date
    Oct 2007
    Location
    Cracow
    Posts
    56
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4.4.0 Problem with QPrintPreviewDialog

    this connect won't work
    Qt Code:
    1. connect( dlg, SIGNAL( paintRequested( devPrint ) ), this, SLOT( slotPrintLog( devPrint ) ) );
    To copy to clipboard, switch view to plain text mode 
    you put value to signal and slot functions

  3. #3
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.4.0 Problem with QPrintPreviewDialog

    That got it. Thanks!

Similar Threads

  1. qtdemo.exe display problem with Qt 4.4.0
    By Dwarf007 in forum Installation and Deployment
    Replies: 5
    Last Post: 4th June 2008, 05:27
  2. Strange Qt 4.4.0 string problem
    By maverick_pol in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2008, 06:46
  3. QT 4.4.0 Upgrade QPainter Problem
    By ChrisReath in forum Qt Programming
    Replies: 4
    Last Post: 13th May 2008, 15:25
  4. Hi. I have problem with QCString in 4.4.0
    By ivi2501 in forum Qt Programming
    Replies: 3
    Last Post: 25th March 2008, 18:30
  5. Qt 4.4.0 make problem
    By MarkoSan in forum Installation and Deployment
    Replies: 24
    Last Post: 22nd January 2008, 17:58

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.