コード例 #1
0
ファイル: ScatterPlotWindow.cpp プロジェクト: assutech/isis3
  /**
   * 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);
    }
  }
コード例 #2
0
ファイル: overhead.cpp プロジェクト: Zeben/QuAmrita5
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()));
}
コード例 #3
0
/**
 * 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
    }

}
コード例 #4
0
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 );
}
コード例 #5
0
ファイル: prntdlgg.cpp プロジェクト: HackLinux/chandler-1
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
}
コード例 #6
0
/*---------------------------------------------------------------------------
* Drucken
*---------------------------------------------------------------------------*/
void DtaStatsFrame::print()
{
   QPrinter *printer = new QPrinter;
   QPrintDialog printDialog(printer, this);
   if (printDialog.exec() == QDialog::Accepted)
      textEdit->print(printer);
}
コード例 #7
0
ファイル: printdialog.cpp プロジェクト: 7modelsan/subsurface
void PrintDialog::printClicked(void)
{
	QPrintDialog printDialog(&printer, this);
	if (printDialog.exec() == QDialog::Accepted){
		printLayout->print();
		close();
	}
}
コード例 #8
0
ファイル: MainWindow.cpp プロジェクト: robcaldecott/jupiter
void MainWindow::print()
{
    QPrintDialog printDialog(printer, this);
    if (printDialog.exec() == QDialog::Accepted)
    {
	preview->print();
    }
}
コード例 #9
0
ファイル: webview.cpp プロジェクト: Eventect/typica
void TypicaWebView::print()
{
QPrinter*printer= new QPrinter(QPrinter::HighResolution);
QPrintDialog printDialog(printer,NULL);
if(printDialog.exec()==QDialog::Accepted)
{
QWebView::print(printer);
}
}
コード例 #10
0
ファイル: fmprintdialog.cpp プロジェクト: gonboy/fontmatrix
FMPrintDialog::FMPrintDialog(QPrinter * printer, QWidget * parent)
	: QDialog(parent)
{
	setupUi(this);
	QPrintDialog  printDialog(printer, printPlaceHolder);
	printDialog.setModal(false);
	printDialog.show();
// 	printDialog.exec();
}
コード例 #11
0
ファイル: print.cpp プロジェクト: nhosproject/OSProject
void Print::printHtml(const QString &html){
    QPrinter  printer;
    QPrintDialog printDialog(&printer);
    if(printDialog.exec()){
        QTextDocument textDocument;
        textDocument.setHtml(html);
        textDocument.print(&printer);
    }
}
コード例 #12
0
ファイル: printdialog.cpp プロジェクト: ngdmcc/subsurface
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();
	}
}
コード例 #13
0
ファイル: helpBrowser.cpp プロジェクト: craftoid/Cstitch
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);
  }
}
コード例 #14
0
void NetworkStatusStatement::onPrintButton()
{
    QPrinter printer;
    QPrintDialog printDialog(&printer, this);
    if(printDialog.exec())
    {
        QPainter painter(&printer);
        //
    }
}
コード例 #15
0
ファイル: mainwindow.cpp プロジェクト: ganquan0910/qt5-demos
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);
    }
}
コード例 #16
0
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();
}
コード例 #17
0
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);
}
コード例 #18
0
ファイル: PrintView.cpp プロジェクト: hheld/JustDoIt
void PrintView::on_pushButton_print_clicked()
{
    QPrinter printer;

    QPrintDialog printDialog(&printer, this);

    if (printDialog.exec() == QDialog::Accepted)
    {
        ui->textEdit->print(&printer);
    }
}
コード例 #19
0
ファイル: CapturePrinter.cpp プロジェクト: damirporobic/ksnip
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);
    }
}
コード例 #20
0
ファイル: mainwindow.cpp プロジェクト: skydion/qtcrossword
void MainWindow::printCrossword(void)
{
  printpreview->updatePreview();

  QPrintDialog printDialog(printer, printpreview);

  if (printDialog.exec() == QDialog::Accepted)
    {
      qDebug() << printpreview->pageCount();
      printpreview->print();
    }
}
コード例 #21
0
ファイル: print.cpp プロジェクト: Jellofishi/Desktop
		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;
		}
コード例 #22
0
ファイル: CapturePrinter.cpp プロジェクト: damirporobic/ksnip
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();
}
コード例 #23
0
ファイル: UtmpWebView.cpp プロジェクト: 2life/BrowserCore
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);
}
コード例 #24
0
ファイル: printdialog.cpp プロジェクト: JasonCC/symphytum
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) + ",");
    }
コード例 #25
0
ファイル: docuwindow.cpp プロジェクト: Fale/qtmoko
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);
}
コード例 #26
0
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);
}
コード例 #27
0
ファイル: mainwindow.cpp プロジェクト: ganquan0910/qt5-demos
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);
    }
}
コード例 #28
0
ファイル: freeDraw.cpp プロジェクト: ynn0s/paint
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
}
コード例 #29
0
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();
	}
}
コード例 #30
0
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);
        }
    }
}