Action print to pdf.
--HG-- branch : feature
This commit is contained in:
parent
e97cceb65b
commit
3c96dfddcb
|
@ -55,5 +55,6 @@
|
||||||
<file>icon/16x16/landscape.png</file>
|
<file>icon/16x16/landscape.png</file>
|
||||||
<file>icon/16x16/portrait.png</file>
|
<file>icon/16x16/portrait.png</file>
|
||||||
<file>icon/16x16/template.png</file>
|
<file>icon/16x16/template.png</file>
|
||||||
|
<file>icon/32x32/pdf.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/share/resources/icon/32x32/pdf.png
Normal file
BIN
src/app/share/resources/icon/32x32/pdf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
|
@ -83,6 +83,7 @@ TableWindow::TableWindow(QWidget *parent)
|
||||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &TableWindow::ShowPaper);
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &TableWindow::ShowPaper);
|
||||||
connect(ui->actionPrint_pre_view, &QAction::triggered, this, &TableWindow::PrintPreview);
|
connect(ui->actionPrint_pre_view, &QAction::triggered, this, &TableWindow::PrintPreview);
|
||||||
connect(ui->action_Print, &QAction::triggered, this, &TableWindow::LayoutPrint);
|
connect(ui->action_Print, &QAction::triggered, this, &TableWindow::LayoutPrint);
|
||||||
|
connect(ui->actionSave_to_p_df, &QAction::triggered, this, &TableWindow::PrintToPdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -341,6 +342,26 @@ void TableWindow::LayoutPrint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TableWindow::PrintToPdf()
|
||||||
|
{
|
||||||
|
// display print dialog and if accepted print
|
||||||
|
QPrinter printer;
|
||||||
|
printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
|
||||||
|
printer.setDocName(fileName);
|
||||||
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
|
|
||||||
|
const QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
||||||
|
QDir::homePath()+"/"+this->fileName+".pdf",
|
||||||
|
tr("PDF file (*.pdf)"));
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
{
|
||||||
|
printer.setOutputFileName(fileName);
|
||||||
|
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
||||||
|
Print( &printer );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::Layout()
|
void TableWindow::Layout()
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,7 @@ public slots:
|
||||||
void PrintPreview();
|
void PrintPreview();
|
||||||
void Print (QPrinter *printer);
|
void Print (QPrinter *printer);
|
||||||
void LayoutPrint();
|
void LayoutPrint();
|
||||||
|
void PrintToPdf();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/** @brief closed emit if window is closing. */
|
/** @brief closed emit if window is closing. */
|
||||||
|
|
|
@ -279,6 +279,10 @@
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Print to p&df</string>
|
<string>Print to p&df</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user