本文整理汇总了C++中QPrintDialog::addEnabledOption方法的典型用法代码示例。如果您正苦于以下问题:C++ QPrintDialog::addEnabledOption方法的具体用法?C++ QPrintDialog::addEnabledOption怎么用?C++ QPrintDialog::addEnabledOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPrintDialog
的用法示例。
在下文中一共展示了QPrintDialog::addEnabledOption方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print
void CentralWidget::print()
{
#ifndef QT_NO_PRINTER
if (HelpViewer* viewer = currentHelpViewer()) {
initPrinter();
QPrintDialog *dlg = new QPrintDialog(printer, this);
dlg->setWindowTitle(tr("Print Document"));
if (!viewer->selectedText().isEmpty())
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
dlg->addEnabledOption(QAbstractPrintDialog::PrintPageRange);
dlg->addEnabledOption(QAbstractPrintDialog::PrintCollateCopies);
if (dlg->exec() == QDialog::Accepted)
viewer->print(printer);
delete dlg;
}
#endif
}
示例2: 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;
}
示例3: 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
}
示例4: 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;
}
示例5: 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
}
示例6: 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
}
示例7: 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
}
示例8: printIt
void MainWindow::printIt(){
#ifndef QT_NO_PRINTER
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this);
dlg->setWindowTitle(tr("Print Results"));
if (ui->plainTextEdit->textCursor().hasSelection()){
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
}
if (dlg->exec() == QDialog::Accepted) {
ui->plainTextEdit->print(&printer);
}
delete dlg;
#endif
}
示例9: printer
void MainWindow::on_pushButton_4_clicked()
{
QTextDocument doc;
QString txt;
txt = ::textAt(h3,65,"ASAP Film Order") %
::textAt(h3,40,"From C&C Special Products Co. 952-881-0073") %
::textAt(h3,67,"Mark Robin") %
::textAt(h3,6,"Attn: Customer Service") % ::nbsp(63) % "Rip Settings:"%
::textAt(h3,103,"1) Film Positives") %
::textAt(h3,103,"2) DO NOT TRAP") %
::textAt(h3,103,"3) Send Pre Separated") %
::textAt(h3,6,"Date: " % ui->dateEdit->text()) %
::textAt(h3,6,"File Name: " % ui->lineEdit_2->text());
qDebug() << "The memory used is: " << txt.capacity();
doc.setHtml(txt);
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this);
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
dlg->setWindowTitle(tr("Print Document"));
if (dlg->exec() == QDialog::Accepted)
{
QPrinter printer;
// printer.setOutputFileName("c:\\temp\\filenew.pdf");
// printer.setOutputFormat(QPrinter::PdfFormat);
qDebug() << "Sending to printer";
doc.print(&printer);
printer.newPage();
printer.setOutputFileName("c:\\temp\\faxASAP.pdf");
printer.setOutputFormat(QPrinter::PdfFormat);
qDebug() << "Creating PDF";
doc.print(&printer);
printer.newPage();
}
delete dlg;
#endif
}
示例10: on_pushButton_clicked
void MainWindow::on_pushButton_clicked()
{
if (ui ->checkBox->checkState()== false) {
ui ->checkBox->click();
}
//ofstream myfile;
//myfile.open ("example.txt");
//myfile << "Writing this to a file.\n";
//myfile.close();
//ui->textEdit->append(ui->lineEdit->text());
//ui->textEdit->append("Hello World");
//ui->textEdit->setHtml("<h1> Hello there "+ui->lineEdit->text());
//ui->textEdit->append("<h1> nice work! </h1>");
//ui->textEdit->setHtml("<h3>11111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000</h3>");
ui->textEdit->setHtml(::textAt(h3,65,"ASAP Film Order"));
ui->textEdit->append(::textAt(h3,40,"From C&C Special Products Co. 952-881-0073"));
ui->textEdit->append(::textAt(h3,67,"Mark Robin"));
ui->textEdit->append(::textAt(h3,6,"Attn: Customer Service"+::nbsp(63)+"Rip Settings:"));
ui->textEdit->append(::textAt(h3,103,"1) Film Positives"));
ui->textEdit->append(::textAt(h3,103,"2) DO NOT TRAP"));
ui->textEdit->append(::textAt(h3,103,"3) Send Pre Separated"));
ui->textEdit->append(::textAt(h3,6,"Date: "+ui->dateEdit->text()));
ui->textEdit->append(::textAt(h3,6,"File Name: "+ui->lineEdit_2->text()));
// Print the page
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this);
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
dlg->setWindowTitle(tr("Print Document"));
if (dlg->exec() == QDialog::Accepted) {
QPrinter printer;
ui->textEdit->print(&printer);
printer.newPage();
}
delete dlg;
#endif
}
示例11: QPrintDialog
void QFESPIMB040ScriptedAcquisition::print()
{
#ifndef QT_NO_PRINTER
if (opticsSetup->getStopRelease(0)) opticsSetup->getStopRelease(0)->stop();
if (opticsSetup->getStopRelease(1)) opticsSetup->getStopRelease(1)->stop();
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);
if (opticsSetup->getStopRelease(0)) opticsSetup->getStopRelease(0)->resume();
if (opticsSetup->getStopRelease(1)) opticsSetup->getStopRelease(1)->resume();
#endif
}
示例12: Painter
void
PrinterWriter::print(QWidget *doc)
{
QPrintDialog *dialog = new QPrintDialog(Printer, 0);
dialog->setWindowTitle(QObject::tr("Print Document"));
dialog->addEnabledOption(QAbstractPrintDialog::PrintSelection);
if (QucsApp::isTextDocument(doc))
{
if (dialog->exec() == QDialog::Accepted) {
static_cast<QPlainTextEdit *>(doc)->print(Printer);
}
}
else {
Printer->setOrientation(QPrinter::Landscape);
if (dialog->exec() == QDialog::Accepted)
{
QPainter Painter(Printer);
if(!Painter.device()) { // valid device available ?
delete dialog;
return;
}
for (int z = Printer->numCopies(); z > 0; --z) {
if (Printer->aborted()) {
break;
}
static_cast<Schematic *>(doc)->print(Printer, &Painter,
Printer->printRange() == QPrinter::AllPages, fitToPage);
if (z > 1 && !Printer->newPage()) {
delete dialog;
return;
}
}
}
}
delete dialog;
}