/** * Provides printing support of the plot image. * */ void ScatterPlotWindow::printPlot() { QPixmap pixmap; /* Initialize a printer*/ static QPrinter *printer = NULL; if (printer == NULL) printer = new QPrinter; printer->setPageSize(QPrinter::Letter); printer->setColorMode(QPrinter::Color); QPrintDialog printDialog(printer,(QWidget *)parent()); if (printDialog.exec() == QDialog::Accepted) { /* Get display widget as a pixmap and convert to an image*/ pixmap = QPixmap::grabWidget(p_plot); QImage img = pixmap.toImage(); /* C++ Gui Programming with Qt, page 201*/ QPainter painter(printer); QRect rect = painter.viewport(); QSize size = img.size(); size.scale(rect.size(),Qt::KeepAspectRatio); painter.setViewport(rect.x(),rect.y(), size.width(),size.height()); painter.setWindow(img.rect()); painter.drawImage(0,0,img); } }
Overhead::Overhead(QWidget *parent) : QDialog(parent), ui(new Ui::Overhead) { ui->setupUi(this); setAttribute( Qt::WA_DeleteOnClose ); // очищать память из кучи Overhead::setupOH(); ui->groupBoxEdit->hide(); ui->groupBoxCell->hide(); ui->groupBoxHackGet->hide(); ui->pushOHPureDel->hide(); ui->pushOHPrint->hide(); // INITS connect(ui->pushOHEdit, SIGNAL(clicked()), this, SLOT(EditParam())); // управление редактированием connect(ui->pushEditApply, SIGNAL(clicked()), this, SLOT(apply())); // применение параметров редактирования connect(ui->pushOHDel, SIGNAL(clicked()), this, SLOT(del())); connect(ui->pushOHCell, SIGNAL(clicked()), this, SLOT(cell())); // хак для динамического изменения окна connect(ui->pushOHEditHack, SIGNAL(clicked()), this, SLOT(edit_hack())); // тоже самое // коннекторы для удаления, редактирования, получения долга на товар connect(ui->pushOHReturnedYes, SIGNAL(clicked()), this, SLOT(isReturnedYes())); connect(ui->pushOHReturnedYes, SIGNAL(clicked()), this, SLOT(on_tableOH_clicked())); connect(ui->pushOHReturnedNo, SIGNAL(clicked()), this, SLOT(isReturnedNo())); connect(ui->pushOHReturnedNo, SIGNAL(clicked()), this, SLOT(on_tableOH_clicked())); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(duty())); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(on_tableOH_clicked())); // тест драйвера печати connect(ui->pushOHPrint, SIGNAL(clicked()), this, SLOT(printDialog())); }
/** * Methode permettant d'imprimer un document */ void ValidDocument::print(){ QWebView webView; QPrinter printer ; printer.setPageSize(QPrinter::A4); printer.setFullPage(true); QString type=(docType==Document::Facture)?QObject::trUtf8("Facture"):QObject::trUtf8("Devis"); printer.setDocName(type+"_"+QString::number(id) ); printer.setCreator(QObject::trUtf8("QFacturation")); printer.setOutputFormat(QPrinter::NativeFormat); webView.setHtml(view); webView.show(); QPrintDialog printDialog(&printer); if(printDialog.exec() == QDialog::Accepted) { qDebug("Ne fonctionne pas sous windows")<<" Hack ...."; #if defined(Q_WS_WIN) QTextDocument text; text.setHtml(view); text.print(&printer); #endif #if defined(Q_WS_QWS) webView.print(&printer); #endif #if defined(Q_WS_X11) webView.print(&printer); #endif } }
void MainWindow::doPrintParameterStatistic() { if ( gv_PS.count() > 0 ) { QTextDocument textDocu; QPrinter printer; QPrintDialog printDialog( &printer, this ); printer.setOrientation( QPrinter::Landscape ); if ( printDialog.exec() == QDialog::Accepted ) { QFileInfo fi( gsl_FilenameList.at( 0 ) ); QFont textFont = QFont( gf_HeaderTextFont.family(), 10, 0, false ); printer.setOutputFileName( tr( "" ) ); textDocu.setHtml( createParameterStatisticOutputText( fi.fileName(), gv_PS ) ); textDocu.setDefaultFont( textFont ); textDocu.print( &printer ); } update(); } setStatusBar( tr( "Done" ), 2 ); }
void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event)) { // We no longer query GetPrintMode, so we can eliminate the need // to call SetPrintMode. // This has the limitation that we can't explicitly call the PostScript // print setup dialog from the generic Page Setup dialog under Windows, // but since this choice would only happen when trying to do PostScript // printing under Windows (and only in 16-bit Windows which // doesn't have a Windows-specific page setup dialog) it's worth it. // First save the current settings, so the wxPrintData object is up to date. TransferDataFromWindow(); // Transfer the current print settings from this dialog to the page setup dialog. #if 0 // Use print factory later wxPrintDialogData data; data = GetPageSetupData().GetPrintData(); data.SetSetupDialog(true); wxPrintDialog printDialog(this, & data); printDialog.ShowModal(); // Transfer the page setup print settings from the page dialog to this dialog again, in case // the page setup dialog changed something. GetPageSetupData().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData(); GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData // Now update the dialog in case the page setup dialog changed some of our settings. TransferDataToWindow(); #endif }
/*--------------------------------------------------------------------------- * Drucken *---------------------------------------------------------------------------*/ void DtaStatsFrame::print() { QPrinter *printer = new QPrinter; QPrintDialog printDialog(printer, this); if (printDialog.exec() == QDialog::Accepted) textEdit->print(printer); }
void PrintDialog::printClicked(void) { QPrintDialog printDialog(&printer, this); if (printDialog.exec() == QDialog::Accepted){ printLayout->print(); close(); } }
void MainWindow::print() { QPrintDialog printDialog(printer, this); if (printDialog.exec() == QDialog::Accepted) { preview->print(); } }
void TypicaWebView::print() { QPrinter*printer= new QPrinter(QPrinter::HighResolution); QPrintDialog printDialog(printer,NULL); if(printDialog.exec()==QDialog::Accepted) { QWebView::print(printer); } }
FMPrintDialog::FMPrintDialog(QPrinter * printer, QWidget * parent) : QDialog(parent) { setupUi(this); QPrintDialog printDialog(printer, printPlaceHolder); printDialog.setModal(false); printDialog.show(); // printDialog.exec(); }
void Print::printHtml(const QString &html){ QPrinter printer; QPrintDialog printDialog(&printer); if(printDialog.exec()){ QTextDocument textDocument; textDocument.setHtml(html); textDocument.print(&printer); } }
void PrintDialog::printClicked(void) { QPrintDialog printDialog(&qprinter, this); if (printDialog.exec() == QDialog::Accepted) { connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int))); printer->print(); close(); } }
void helpBrowser::processPrint() { QPrinter printer; //printer.setOutputFileName("helpOut.pdf"); QPrintDialog printDialog(&printer, this); const int dialogReturnCode = printDialog.exec(); if (dialogReturnCode == QDialog::Accepted) { browser_->print(&printer); } }
void NetworkStatusStatement::onPrintButton() { QPrinter printer; QPrintDialog printDialog(&printer, this); if(printDialog.exec()) { QPainter painter(&printer); // } }
void MainWindow::on_action_print_text_triggered() { QPrinter printer; QPrintDialog printDialog(&printer,this); if(printDialog.exec()) { QTextDocument *doc =ui->sans_text->document(); doc->print(&printer); } }
void RecordTableController::onPrintClick(void) { RecordTableScreen *parentPointer=qobject_cast<RecordTableScreen *>(parent()); RecordTablePrint printDialog(parentPointer); printDialog.setModel(recordProxyModel); printDialog.generateHtmlTableFromModel(); printDialog.setTitleToHtml( recordSourceModel->getTableData()->getItem()->getPathAsNameWithDelimeter(" / ") ); printDialog.exec(); }
void PrintDialog::sPrint() { QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); QPrintDialog printDialog(&printer, this); printDialog.setWindowTitle(tr("Print Document")); if (printDialog.exec() != QDialog::Accepted) return; m_ui.m_text_edit->print(&printer); }
void PrintView::on_pushButton_print_clicked() { QPrinter printer; QPrintDialog printDialog(&printer, this); if (printDialog.exec() == QDialog::Accepted) { ui->textEdit->print(&printer); } }
void CapturePrinter::print(const QImage &image, const QString &defaultPath) { QPrinter printer; printer.setOutputFileName(defaultPath); printer.setOutputFormat(QPrinter::NativeFormat); QPrintDialog printDialog(&printer, 0); if (printDialog.exec() == QDialog::Accepted) { printCapture(image, &printer); } }
void MainWindow::printCrossword(void) { printpreview->updatePreview(); QPrintDialog printDialog(printer, printpreview); if (printDialog.exec() == QDialog::Accepted) { qDebug() << printpreview->pageCount(); printpreview->print(); } }
void fontList(QStringList fonts, QWidget *parent, QString preview_text, int font_size) { QPrinter *printer = new QPrinter; QPrintDialog printDialog(printer, parent); if (printDialog.exec() == QDialog::Accepted) { QTextDocument *print_document = createFontListDocument(fonts, preview_text, font_size); print_document->print(printer); delete print_document; } delete printer; }
void CapturePrinter::printPreview(const QImage &image, const QString &defaultPath) { QPrinter printer; printer.setOutputFileName(defaultPath); printer.setOutputFormat(QPrinter::NativeFormat); QPrintPreviewDialog printDialog(&printer); connect(&printDialog, &QPrintPreviewDialog::paintRequested, [this, image](QPrinter *p) { printCapture(image, p); }); printDialog.exec(); }
void UtmpWebView::customPrintRequested(QWebFrame* frame) { QPrinter* p = new QPrinter(QPrinter::HighResolution); //frame->print(p); //QPrinter p; QPrintDialog printDialog(p, this); printDialog.setWindowTitle("UTMP打印"); if(printDialog.exec() != QDialog::Accepted) { return; } frame->print(p); }
void PrintDialog::print(bool pdf, QString pdfOutputPath) { QPrinter printer; QTextDocument document(this); QString htmlString; QString tableName = m_metadataEngine->getTableName(m_collectionId); QSqlDatabase db = DatabaseManager::getInstance().getDatabase(); QSqlQuery query(db); if (pdf) { printer.setOutputFileName(pdfOutputPath); printer.setOutputFormat(QPrinter::PdfFormat); } else { QPrintDialog printDialog(&printer, this); if (printDialog.exec() != QDialog::Accepted) { ui->stackedWidget->setCurrentIndex(0); return; } } //init html htmlString.append(QString( "<html>" "<head>" "<style type=\"text/css\">" "table" "{" "border-collapse:collapse;" "}" "table, th, td" "{" "border: 1px solid #D3D3D3;" "padding: 5px;" "font-size: 11pt;" "}" "</style>" "</head>" "<body>" "<p>Generated by %1 on %2</p><br />" ) .arg(DefinitionHolder::NAME) .arg(QDateTime::currentDateTime().toString())); //get all record to print QString recordListString; foreach (int id, m_recordList) { recordListString.append(QString::number(id) + ","); }
void DocuWindow::print() { QPrinter printer; if (printer.printerName().isEmpty()) { statusBar()->showMessage(tr("No printer installed"), 2000); return; } QPrintDialog printDialog(&printer, this); if (!printDialog.exec()) { statusBar()->showMessage(tr("Printing aborted"), 2000); return; } browser->document()->print(&printer); }
void Matrix::print(const QString& fileName) { QPrinter printer; printer.setColorMode (QPrinter::GrayScale); if (!fileName.isEmpty()){ printer.setCreator("QtiPlot"); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); } else { QPrintDialog printDialog(&printer, applicationWindow()); if (printDialog.exec() != QDialog::Accepted) return; } printer.setFullPage( true ); print(&printer); }
void MainWindow::on_action_print_img_triggered() { QPrinter printer; QPrintDialog printDialog(&printer,this); if(printDialog.exec()) { QPainter painter(&printer); QRect rect =painter.viewport(); QImage img = ui->sans_img->pixmap()->toImage(); QSize size = img.size(); size.scale(rect.size(),Qt::KeepAspectRatio); painter.setViewport(rect.x(),rect.y(),size.width(),size.height()); painter.setWindow(img.rect()); painter.drawImage(0,0,img); } }
void ScribbleArea::print() { #if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) QPrinter printer(QPrinter::HighResolution); QPrintDialog printDialog(&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); } #endif // QT_NO_PRINTER }
void PrintDialog::printClicked(void) { QPrintDialog printDialog(&qprinter, this); if (printDialog.exec() == QDialog::Accepted) { switch (printOptions.type) { case print_options::DIVELIST: connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int))); printer->print(); break; case print_options::TABLE: break; case print_options::STATISTICS: break; } close(); } }
void MainWindowApplication::printProject() { if (qobject_cast<PrintableWindow *>(ui->mdiArea->activeSubWindow()->widget()) != NULL) { PrintableWindow *wnd = qobject_cast<PrintableWindow *>(ui->mdiArea->activeSubWindow()->widget()); QPrinter printer; QPrintDialog printDialog(&printer, this); if (printDialog.exec()) { //QPainter painter(&printer); QTextDocument textDocument; textDocument.setHtml(wnd->toHtml()); textDocument.print(&printer); } } }