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


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

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


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

示例1: on_pushButton_clicked

void MainWindow::on_pushButton_clicked()
{
    /* To use this function, add these includes:
     *
    #include <QPrinter>
    #include <QPrintDialog>
    #include <QPainter>
     *
     *
     Change '.pro' file to include these lines:

        greaterThan(QT_MAJOR_VERSION, 4){
         QT += widgets
         QT += printsupport
        }
     *
     *
     */
    QPrinter printer;

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

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

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

示例2: disp

void
message_view::print()
{
  QPrinter printer;
  QPrintDialog *dialog = new QPrintDialog(&printer, this);
  dialog->setWindowTitle(tr("Print Document"));
  if (dialog->exec() != QDialog::Accepted)
    return;

  delete dialog;
  m_pmsg->fetch_body_text(false);
  QString html_body = m_bodyv->page()->mainFrame()->toHtml();

  mail_displayer disp(this);
  body_view* printview = new body_view(NULL);
  printview->set_mail_item(m_bodyv->mail_item());
  printview->display(html_body);

  const struct display_prefs& prefs = m_parent->get_display_prefs();
  QString h = disp.sprint_headers(prefs.m_show_headers_level, m_pmsg);
  QString hmore = disp.sprint_additional_headers(prefs, m_pmsg);
  h.append(hmore);
  printview->prepend_body_fragment(h);

  printview->print(&printer);
  delete printview;
}
开发者ID:AleksKots,项目名称:Manitou,代码行数:27,代码来源:message_view.cpp

示例3: printAllClick

//Print clicked, format all lists
//for printing
void TaskList_Main::printAllClick(){
    QPrinter printer;

    //Create new print dialog (select printer)
    QPrintDialog *pDialog = new QPrintDialog(&printer, this);
    pDialog->setWindowTitle(tr("Print Document"));
    if(pDialog->exec() != QDialog::Accepted)
        return;
    else{
        QTextDocument document;
        QString html = "";

        for(int i = 0; i < listPane->mainList->count(); ++i){
            QListWidgetItem *currList = listPane->mainList->item(i);
            my_listwidget *currNote = notePane->listMap[currList];

            //Generate HTML driven output
            html += "<font size=\"7\"><b>" + currList->text() + "</b></font><br />";
            for(int i = 0; i < currNote->count(); i++){
                if(currNote->item(i)->flags() != 0)
                    html += "<font size=\"5\">" + currNote->item(i)->text() + "</font><br />";
                else
                    html += "--<font size=\"4\"><i>" + currNote->item(i)->text() + "</i></font><br />";
            }

            html += "<br />";
        }

        //Set document's HTML info
        document.setHtml(html);

        //Print the HTML text
        document.print(&printer);
    }
}
开发者ID:ep3998,项目名称:Tasklist493---Test,代码行数:37,代码来源:tasklist_main.cpp

示例4: print

bool XmlPdf::print(QString file) {
	QPrinter printer(QPrinter::HighResolution);
	printer.setPaperSize(paperSize);
	printer.setOrientation(paperOrientation);
	printer.setOutputFormat(QPrinter::PdfFormat);
	printer.setPageMargins(8.53, 8.53, 3.53, 3.53, QPrinter::Millimeter);
	
	if (file.isEmpty()) {
		QPrintDialog *dialog = new QPrintDialog(&printer);
		dialog->setWindowTitle(QObject::tr("Print Document"));
		if (dialog->exec() != QDialog::Accepted) {
			qDebug() << "Printing aborted and no Filename given, canceled printing...";
			return false;
		}
	} else {
		printer.setOutputFileName(file);
	}
	
	QPainter *painter = new QPainter();
	if (!painter->begin(&printer)) {
		qDebug() << QString("The File is not writable:\n%1").arg(file);
		return false;
	}
	
	addDynamics(painter, &printer);
	addStatics(painter);
	painter->end();
	return true;
}
开发者ID:LukyLuke,项目名称:PiTres,代码行数:29,代码来源:XmlPdf.cpp

示例5: on_toolButton_print_clicked

void PringKvitok::on_toolButton_print_clicked()
{
#if !defined(QT_NO_PRINTER)

    QPrinter printer(QPrinter::HighResolution);
    QPrintDialog *dlg = new QPrintDialog(&printer, this);

   dlg->setWindowTitle(tr("Настройки принтера"));
   if (dlg->exec() == QDialog::Accepted){
       QString pg;
       QMapIterator<QString, QCheckBox*> i(childsCheckBox_map);
       ui->progressBar->setVisible(true);
       int count = 0;
       int c = 0;
       while (i.hasNext()) {
           i.next();
            QCheckBox *cb = i.value();
            if (cb->checkState() == Qt::Checked){
                count++;
             }
       }

       ui->progressBar->setMaximum(count);
       QString page1;
       QString page2;
       while (i.hasPrevious()) {
           i.previous();
           QCheckBox *cb = i.value();

            if (cb->checkState() == Qt::Checked){
                if (ui->checkBox_twokv->checkState() == Qt::Checked){
                if (page1 == "") page1 = prepareKvit(cb->text());
                else {
                   page2 = prepareKvit(cb->text());
                   pg += TwoKvitOnePage(page1, page2);
                   page1 = "";
                   page2 = "";
                }
             } else pg += prepareKvit(cb->text());
             ui->progressBar->setValue(c++);
           }

       }
       if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1;
        QTextDocument textDocument;

        textDocument.setHtml(pg);
         QPrinter printer(QPrinter::HighResolution);
         printer.setOrientation(QPrinter::Portrait);
         printer.setPaperName("A4");
         printer.setPageMargins(0.3, 0.3, 0.3, 0.3, QPrinter::Unit() );
         if (ui->checkBox_duplex->checkState() == Qt::Checked)printer.setDuplex(QPrinter::DuplexAuto);
         textDocument.print(&printer);
          ui->progressBar->setVisible(false);
   }
   delete dlg;
 #endif
}
开发者ID:haltxz,项目名称:ds,代码行数:58,代码来源:pringkvitok.cpp

示例6: on_printButton_clicked

void PrintDialog::on_printButton_clicked()
{
  QPrinter printer;
  printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
  QPrintDialog *dialog = new QPrintDialog(&printer, this);
  dialog->setWindowTitle(tr("Print Document"));
  if (dialog->exec() != QDialog::Accepted)
    return;
  ui->textEdit->print(&printer);
}
开发者ID:BenZoFly,项目名称:opentx,代码行数:10,代码来源:printdialog.cpp

示例7: on_actionPrint_triggered

void MainWindow::on_actionPrint_triggered()
{
    QPrinter printer(QPrinter::HighResolution);
    QPrintDialog *dlg = new QPrintDialog(&printer, this);
    if (textEditor.editor->textCursor().hasSelection())
        dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
    dlg->setWindowTitle(tr("打印试卷"));
    if (dlg->exec() == QDialog::Accepted)
        textEditor.editor->print(&printer);
    delete dlg;
}
开发者ID:KanagiMiss,项目名称:testassist,代码行数:11,代码来源:mainwindow.cpp

示例8: on_printButton_clicked

void printDialog::on_printButton_clicked()
{
    QPrinter printer;

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

    te->print(&printer);
}
开发者ID:chrisshum128,项目名称:mbtx,代码行数:11,代码来源:printdialog.cpp

示例9: printView

bool DatapickerImage::printView() {
	QPrinter printer;
	QPrintDialog* dlg = new QPrintDialog(&printer, m_view);
    bool ret;
	dlg->setWindowTitle(i18n("Print Datapicker Image"));
    if ( (ret = (dlg->exec() == QDialog::Accepted)) ) {
		DatapickerImageView* view = reinterpret_cast<DatapickerImageView*>(m_view);
		view->print(&printer);
	}
	delete dlg;
    return ret;
}
开发者ID:gerlachs,项目名称:labplot,代码行数:12,代码来源:DatapickerImage.cpp

示例10: setup

void PrinterSetListPrinter::setup()
{
	m_printer = new QPrinter;
	QPrintDialog *dialog = new QPrintDialog(m_printer, 0);
	dialog->setWindowTitle( "Test" );

	if( dialog->exec() == QDialog::Rejected )
	{
		m_hasCancelled = true;
		dialog->deleteLater();
	}
}
开发者ID:mlarouche,项目名称:My-Backstage,代码行数:12,代码来源:printersetlistprinter.cpp

示例11: printView

bool Worksheet::printView() {
	QPrinter printer;
	QPrintDialog* dlg = new QPrintDialog(&printer, m_view);
	dlg->setWindowTitle(i18n("Print Worksheet"));
    bool ret;
    if ((ret = dlg->exec() == QDialog::Accepted)) {
		WorksheetView* view = reinterpret_cast<WorksheetView*>(m_view);
		view->print(&printer);
	}
	delete dlg;
    return ret;
}
开发者ID:prakritibhrdwj,项目名称:labplot,代码行数:12,代码来源:Worksheet.cpp

示例12: on_action_Print_triggered

void SoulNote::on_action_Print_triggered()
{
    /*! \todo add document title, date and time & .... !*/
#ifndef QT_NO_PRINTER
    QPrintDialog *dialog = new QPrintDialog(m_printer, this);
    QPrintDialog d(m_printer, this);
    dialog->setWindowTitle(tr("Print Document"));
    d.setWindowTitle(tr("Print Document"));
    if (d.exec() != QDialog::Accepted)
        return;
    textEditor->print(m_printer);
#endif
}
开发者ID:thesoulless,项目名称:SoulNote,代码行数:13,代码来源:soulnote.cpp

示例13: 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:crobertd,项目名称:qtbase,代码行数:13,代码来源:textedit.cpp

示例14: filePrint

void MainWindow::filePrint()
{
    QPrinter printer;
    QPrintDialog *dlg = new QPrintDialog(&printer, this);
    dlg->setWindowTitle(tr("Print Document"));

    if (ui->webView->hasSelection())
        dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);

    if (dlg->exec() == QDialog::Accepted)
        ui->webView->print(&printer);

    delete dlg;
}
开发者ID:CodingGears,项目名称:CuteMarkEd,代码行数:14,代码来源:mainwindow.cpp

示例15:

bool Kde4PrinterIntegration::RunPrintDialog(X11Types::Window parent)
{
	QPrintDialog* dialog = KdePrint::createPrintDialog(m_printer, QList<QWidget*>());
	if (!dialog)
		return false;

	dialog->setWindowTitle(m_caption);
	Kde4Utils::SetResourceName(dialog, "printdialog");

	int result = Kde4Utils::RunDialog(dialog, parent);
	delete dialog;

	return (result == QDialog::Accepted);
}
开发者ID:prestocore,项目名称:browser,代码行数:14,代码来源:Kde4PrinterIntegration.cpp


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