PrintPreview



  • Hi,

    I'm trying to do a print preview(I'm able to print (on printer only)). So I use QPrintPreviewWidget
    but I don't know how to use it.
    I did something like this

    MdPrintPreviewDialog::MdPrintPreviewDialog(MdPrinter *pPrinter, QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MdPrintPreviewDialog), m_pSharedPrinter{pPrinter}
    {
        ui->setupUi(this);
        m_pPrintProgress = new QProgressBar(this);
        ui->statusbar->addWidget(m_pPrintProgress);
        m_pPrintProgress->setVisible(false);
        if(m_pSharedPrinter)
        {
            m_pSharedPrinter->createPrinter(true, false);
            QPrintPreviewWidget* pPreviewer = new QPrintPreviewWidget(m_pSharedPrinter->printer());
            setCentralWidget(pPreviewer);
            QObject::connect(pPreviewer, SIGNAL(paintRequested(QPrinter*)), this, SLOT(pPreviewer(QPrinter*)));
            pPreviewer->updatePreview();
        }
        showMaximized();
    }
    

    Nothing appends so what I do wrong ?

    thanks.
    Sorry for my english.


  • Lifetime Qt Champion

    Hi,

    Did you check that m_pSharedPrinter is not null ?

    And what do you mean exactly by "nothing appends" ?



  • Sorry,
    when I recheck what I wrote upper, I see my mistake. The SLOT was wrong.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.