Fix fontsampler build with QT_NO_PRINTER / QT_NO_PRINTDIALOG
Change-Id: I4495949580846e9b04c8e15a756c0d5a64d69c0c Reviewed-by: Lars Knoll <lars.knoll@qt.io>bb10
parent
aba5801a32
commit
8eb3f58609
|
|
@ -214,9 +214,9 @@ QMap<QString, StyleItems> MainWindow::currentPageMap()
|
|||
return pageMap;
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
void MainWindow::on_printAction_triggered()
|
||||
{
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
pageMap = currentPageMap();
|
||||
|
||||
if (pageMap.count() == 0)
|
||||
|
|
@ -233,10 +233,12 @@ void MainWindow::on_printAction_triggered()
|
|||
printer.setFromTo(1, pageMap.keys().count());
|
||||
|
||||
printDocument(&printer);
|
||||
#endif // QT_NO_PRINTER
|
||||
}
|
||||
|
||||
void MainWindow::printDocument(QPrinter *printer)
|
||||
{
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
printer->setFromTo(1, pageMap.count());
|
||||
|
||||
QProgressDialog progress(tr("Preparing font samples..."), tr("&Cancel"),
|
||||
|
|
@ -265,10 +267,12 @@ void MainWindow::printDocument(QPrinter *printer)
|
|||
}
|
||||
|
||||
painter.end();
|
||||
#endif // QT_NO_PRINTER
|
||||
}
|
||||
|
||||
void MainWindow::on_printPreviewAction_triggered()
|
||||
{
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
pageMap = currentPageMap();
|
||||
|
||||
if (pageMap.count() == 0)
|
||||
|
|
@ -279,10 +283,12 @@ void MainWindow::on_printPreviewAction_triggered()
|
|||
connect(&preview, SIGNAL(paintRequested(QPrinter*)),
|
||||
this, SLOT(printDocument(QPrinter*)));
|
||||
preview.exec();
|
||||
#endif // QT_NO_PRINTER
|
||||
}
|
||||
|
||||
void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
|
||||
{
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
QString family = pageMap.keys()[index];
|
||||
StyleItems items = pageMap[family];
|
||||
|
||||
|
|
@ -345,5 +351,5 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
|
|||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
#endif // QT_NO_PRINTER
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,15 +72,11 @@ public:
|
|||
public slots:
|
||||
void on_clearAction_triggered();
|
||||
void on_markAction_triggered();
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
void on_printAction_triggered();
|
||||
void on_printPreviewAction_triggered();
|
||||
#endif
|
||||
void on_unmarkAction_triggered();
|
||||
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||
void printDocument(QPrinter *printer);
|
||||
void printPage(int index, QPainter *painter, QPrinter *printer);
|
||||
#endif
|
||||
void showFont(QTreeWidgetItem *item);
|
||||
void updateStyles(QTreeWidgetItem *item, int column);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue