当前位置: 首页>>代码示例>>C++>>正文


C++ QPrintDialog::exec方法代码示例

本文整理汇总了C++中QPrintDialog::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ QPrintDialog::exec方法的具体用法?C++ QPrintDialog::exec怎么用?C++ QPrintDialog::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPrintDialog的用法示例。


在下文中一共展示了QPrintDialog::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: filePrint

void TextEdit::filePrint()
{
#ifndef QT_NO_PRINTER
    QPrinter printer(QPrinter::HighResolution);
    QPrintDialog *dlg = new QPrintDialog(&printer, this);
    if (textEdit->textCursor().hasSelection())
        dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
    dlg->setWindowTitle(tr("Print Document"));
    if (dlg->exec() == QDialog::Accepted) {
        textEdit->print(&printer);
    }
    delete dlg;
#endif
}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:14,代码来源:textedit.cpp

示例2: slotPrintReport

void KexiReportView::slotPrintReport()
{
    QPrinter printer;
    ORPrintRender pr;

    // do some printer initialization
    pr.setPrinter(&printer);
    pr.setupPrinter(m_reportDocument, &printer);

    QPrintDialog *dialog = new QPrintDialog(&printer, this);
    if (dialog->exec() != QDialog::Accepted)
        return;

    pr.render(m_reportDocument);
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:15,代码来源:kexireportview.cpp

示例3: QPrintDialog

void Qtilities::CoreGui::MessagesPlainTextEditTab::handle_Print() {
#ifndef QT_NO_PRINTER
     QPrinter printer;

     QPrintDialog *dialog = new QPrintDialog(&printer, this);
     dialog->setWindowTitle(tr("Print Current Log"));
     if (d->txtLog.textCursor().hasSelection())
         dialog->addEnabledOption(QAbstractPrintDialog::PrintSelection);
     if (dialog->exec() != QDialog::Accepted)
         return;

     delete dialog;
     d->txtLog.print(&printer);
#endif
}
开发者ID:CJCombrink,项目名称:Qtilities,代码行数:15,代码来源:WidgetLoggerEngineFrontend.cpp

示例4: print

void ImageArea::print()
{
    QPrinter *printer = new QPrinter();
    QPrintDialog *printDialog = new QPrintDialog(printer);
    if(printDialog->exec())
    {
        QPainter painter(printer);
        QRect rect = painter.viewport();
        QSize size = mImage->size();
        size.scale(rect.size(), Qt::KeepAspectRatio);
        painter.setViewport(rect.x(), rect.y(), size.width(), size.height());
        painter.setWindow(mImage->rect());
        painter.drawImage(0, 0, *mImage);
    }
}
开发者ID:edo248,项目名称:EasyPaint,代码行数:15,代码来源:imagearea.cpp

示例5: print

void MainWindow::print()
{

    QPrinter printer;
    QPainter painter;
    QPrintDialog *dialog = new QPrintDialog(&printer);
    dialog->setWindowTitle("Print  Document");
    if (dialog->exec() != QDialog::Accepted)
        return;
    painter.begin(&printer);
    ui->treeWidget->expandAll();
    ui->treeWidget->render(&painter);
    ui->treeWidget->collapseAll();
    painter.end();
}
开发者ID:dnewell,项目名称:AcuitySTAR-Dashboard,代码行数:15,代码来源:mainwindow.cpp

示例6: print

void MessageWidget::print()
{
#ifndef QT_NO_PRINTER
	QPrinter printer(QPrinter::HighResolution);
	printer.setFullPage(true);
	QPrintDialog *dlg = new QPrintDialog(&printer, this);
	if (ui.msgText->textCursor().hasSelection())
		dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
	dlg->setWindowTitle(tr("Print Document"));
	if (dlg->exec() == QDialog::Accepted) {
		ui.msgText->print(&printer);
	}
	delete dlg;
#endif
}
开发者ID:ShadowMyst,项目名称:RetroShare,代码行数:15,代码来源:MessageWidget.cpp

示例7: print

//! [3]
void MainWindow::print()
{
#ifndef QT_NO_PRINTDIALOG
    QTextDocument *document = textEdit->document();
    QPrinter printer;

    QPrintDialog *dlg = new QPrintDialog(&printer, this);
    if (dlg->exec() != QDialog::Accepted)
        return;

    document->print(&printer);

    statusBar()->showMessage(tr("Ready"), 2000);
#endif
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:16,代码来源:mainwindow.cpp

示例8: printThis

void PrintingService::printThis(QTableView *tableToPrint){
    QString strStream;
    QTextStream out(&strStream);
    QString strTitle;

    const int rowCount = tableToPrint->model()->rowCount();
    const int columnCount = tableToPrint->model()->columnCount();

    out <<  "<html>\n <head>\n <meta Content=\"Text/html; charset=Windows-1251\">\n"
         <<  QString("<title>%1</title>\n").arg(strTitle)
          <<  "</head>\n"
              "<body bgcolor=#ffffff link=#5000A0>\n"
              "<table border=1 cellspacing=0 cellpadding=2>\n";

    // headers
    out << "<thead><tr bgcolor=#f0f0f0>";
    for (int column = columnCount-1; column >= 0 ; column--)
        if (!tableToPrint->isColumnHidden(column))
            out << QString("<th>%1</th>").arg(tableToPrint->model()->headerData(column, Qt::Horizontal).toString());
    out << "</tr></thead>\n";

    // data table
    for (int row = 0; row < rowCount; row++) {
        out << "<tr>";
        for (int column = columnCount-1; column >=0 ; column--) {
            if (!tableToPrint->isColumnHidden(column)) {
                QString data = tableToPrint->model()->data(tableToPrint->model()->index(row, column)).toString().simplified();
                out << QString("<td bkcolor=0>%1</td>").arg((!data.isEmpty()) ? data : QString("&nbsp;"));
            }
        }
        out << "</tr>\n";
    }
    out <<  "</table>\n"
            "</body>\n"
            "</html>\n";

    QTextDocument *document = new QTextDocument();
    document->setHtml(strStream);

    QPrinter printer;

    QPrintDialog *dialog = new QPrintDialog(&printer, NULL);
    if (dialog->exec() == QDialog::Accepted) {
        document->print(&printer);
    }

    delete document;
}
开发者ID:SudanBoy,项目名称:Muwassa,代码行数:48,代码来源:printingservice.cpp

示例9: print

void QFEHelpEditorWidget::print()
{
#ifndef QT_NO_PRINTER
   QPrinter printer;

   QPrintDialog *dialog = new QPrintDialog(&printer, this);
   dialog->setWindowTitle(tr("Print Document"));
   if (ui->edtScript->getEditor()->textCursor().hasSelection())
       dialog->addEnabledOption(QAbstractPrintDialog::PrintSelection);
   if (dialog->exec() != QDialog::Accepted)
       return;

   ui->edtScript->getEditor()->print(&printer);
#endif

}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:16,代码来源:qfehelpeditorwidget.cpp

示例10: slotFilePrint

void KMouthApp::slotFilePrint()
{
    slotStatusMsg(i18n("Printing..."));

    if (printer == 0) {
        printer = new QPrinter();
    }

    QPrintDialog *printDialog = KdePrint::createPrintDialog(printer, this);

    if (printDialog->exec()) {
        phraseList->print(printer);
    }

    slotStatusMsg(i18nc("The job is done", "Ready."));
}
开发者ID:KDE,项目名称:kmouth,代码行数:16,代码来源:kmouth.cpp

示例11: printPdf

void ScribbleArea::printPdf()
{
    QPrinter printer(QPrinter::HighResolution);
    printer.setOutputFormat(QPrinter::PdfFormat);

    QPrintDialog *printDialog = new QPrintDialog(&printer, this);
    if (printDialog->exec() == QDialog::Accepted) {
        QPainter painter(&printer);
        QRect rect = painter.viewport();
        QSize size = image.size();
        size.scale(rect.size(), Qt::KeepAspectRatio);
        painter.setViewport(rect.x(), rect.y(), size.width(), size.height());
        painter.setWindow(image.rect());
        painter.drawImage(0, 0, image);
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:16,代码来源:scribblearea.cpp

示例12: on_actionPrint_triggered

void MainWindow::on_actionPrint_triggered()
{
    QGraphicsScene printScene;
    QPixmap img;
    QPrinter printer;
    QPrintDialog *dialog = new QPrintDialog(&printer, this);
    dialog->setWindowTitle("Print Coupons");
    if (dialog->exec() != QDialog::Accepted)
        return;
    QPainter painter(&printer);
    printScene.setSceneRect(0, 0, 920, 1400);
    img.loadFromData(coupon.couponFile);
    coupon.drawCouponPage(&printScene, img, ui->horizontalSlider->value());
    printScene.render(&painter);
    ui->statusBar->showMessage("Coupon page sent to printer.");
}
开发者ID:gdub999,项目名称:Hobby-Lobby-Coupon-Downloader,代码行数:16,代码来源:mainwindow.cpp

示例13: printButtonPushed

void barchartdialog::printButtonPushed()
{
    QPrinter printer;

    QPrintDialog *dialog = new QPrintDialog(&printer, this);
    dialog->setWindowTitle(tr("Print Document"));

    if (dialog->exec() != QDialog::Accepted)
        return;

    QPixmap pixmap = QPixmap::grabWidget(this, 0, 0, -1, -1);
    QPainter painter;
    painter.begin(&printer);
    painter.drawImage(0, 0, pixmap.toImage());
    painter.end();
}
开发者ID:james007crocker,项目名称:V3_Submission_Dec9th,代码行数:16,代码来源:barchartdialog.cpp

示例14: documentPrint

void MainWindow::documentPrint(void)
{
    Canvas *currCanvas = canvas();
    QPrinter printer;

    QPrintDialog *dialog = new QPrintDialog(&printer, this);
    dialog->setWindowTitle(tr("Print Document"));
    if (dialog->exec() == QDialog::Accepted)
    {
        QPainter painter(&printer);
        painter.setRenderHint(QPainter::Antialiasing);
        currCanvas->setRenderingForPrinting(true);
        currCanvas->render(&painter, QRectF(),
                currCanvas->pageRect());
        currCanvas->setRenderingForPrinting(false);
    }
}
开发者ID:skieffer,项目名称:ortho,代码行数:17,代码来源:mainwindow.cpp

示例15: printImage

void KStars::printImage( bool usePrintDialog, bool useChartColors ) {
    //QPRINTER_FOR_NOW
//    KPrinter printer( true, QPrinter::HighResolution );
    QPrinter printer( QPrinter::HighResolution );
    printer.setFullPage( false );

    //Set up the printer (either with the Print Dialog,
    //or using the default settings)
    bool ok( false );
    if ( usePrintDialog ) {
        //QPRINTER_FOR_NOW
//        ok = printer.setup( this, i18n("Print Sky") );
        QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this);
        dialog->setWindowTitle( i18n("Print Sky") );
        if ( dialog->exec() == QDialog::Accepted )
            ok = true;
        delete dialog;
    } else {
        //QPRINTER_FOR_NOW
//        ok = printer.autoConfigure();
        ok = true;
    }

    if( ok ) {
        QApplication::setOverrideCursor( Qt::WaitCursor );

        //Save current ColorScheme file name and switch to Star Chart
        //scheme (if requested)
        QString schemeName = data()->colorScheme()->fileName();
        if ( useChartColors ) {
            loadColorScheme( "chart.colors" );
        }

        map()->setupProjector();
        map()->exportSkyImage( &printer );

        //Restore old color scheme if necessary
        //(if printing was aborted, the ColorScheme is still restored)
        if ( useChartColors ) {
            loadColorScheme( schemeName );
            map()->forceUpdate();
        }

        QApplication::restoreOverrideCursor();
    }
}
开发者ID:monisha4,项目名称:kstars-hackfest,代码行数:46,代码来源:kstarsdcop.cpp


注:本文中的QPrintDialog::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。