30 #include "ui_me_shortcuts_dialog.h"
32 #include <QApplication>
34 #include <QFileDialog>
36 #include <QTextDocument>
37 #include <QPageLayout>
39 #include <QPrintPreviewDialog>
40 #include <QPrintDialog>
45 #include "../mapplication.h"
51 , isInitialized(false)
54 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
70 QDialog::showEvent( event );
71 if ( event->spontaneous() )
82 setMaximumSize(size());
83 setMinimumSize(size());
93 ui->shortcuts_TextBrowser->selectAll();
94 ui->shortcuts_TextBrowser->copy();
99 QPrintDialog printDialog(&printer);
100 if(printDialog.exec())
102 QTextDocument textDocument;
103 textDocument.setHtml(
ui->shortcuts_TextBrowser->toHtml());
104 textDocument.print(&printer);
110 QString filename = QFileDialog::getSaveFileName(
nullptr, tr(
"Export PDF"), QString(),
111 "*.pdf",
nullptr, QFileDialog::DontUseNativeDialog);
113 if (QFileInfo(filename).suffix().isEmpty())
115 filename.append(
".pdf");
117 QPrinter printer(QPrinter::PrinterResolution);
118 printer.setOutputFormat(QPrinter::PdfFormat);
119 printer.setPageSize(printer.pageLayout().pageSize());
120 printer.setOutputFileName(filename);
122 QTextDocument textDocument;
123 textDocument.setHtml(
ui->shortcuts_TextBrowser->toHtml());
124 textDocument.setPageSize(printer.pageLayout().paintRectPixels(printer.resolution()).size());
125 textDocument.print(&printer);
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE
MeShortcutsDialog(QWidget *parent=nullptr)
virtual ~MeShortcutsDialog()
Ui::MeShortcutsDialog * ui