本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例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;
}
示例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
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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
}
示例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
}
示例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;
}
示例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);
}