Doc: Remove widgets examples from Qt Print Support documentation
The .qdocconf file for Qt Print Support includes examples/widgets in its exampledirs, presumably because a few examples there have printing support. The documentation for these examples is not accessible from Print Support index/module pages, and qdoc prints a lot of warnings for them (missing images). There's only few dependencies to examples in Print Support docs. These are resolved by copying a code snippet to correct place, and removing \sa links from QAbstractPrintDialog. Task-number: QTBUG-31137 Change-Id: Iac20d151f93ac16449241c6ee85979781b26e607 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
parent
85e61297f7
commit
b735ef88a2
@ -404,8 +404,7 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter)
|
|||||||
Mac OS X. This is no longer supported in Qt 4.5. If you want this
|
Mac OS X. This is no longer supported in Qt 4.5. If you want this
|
||||||
functionality, use QPrintDialog::open().
|
functionality, use QPrintDialog::open().
|
||||||
|
|
||||||
\sa QPageSetupDialog, QPrinter, {Pixelator Example}, {Order Form Example},
|
\sa QPageSetupDialog, QPrinter
|
||||||
{Image Viewer Example}, {Scribble Example}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -33,8 +33,7 @@ headerdirs += ..
|
|||||||
|
|
||||||
sourcedirs += ..
|
sourcedirs += ..
|
||||||
|
|
||||||
exampledirs += ../../../examples/widgets \
|
exampledirs += ../ \
|
||||||
../ \
|
|
||||||
snippets
|
snippets
|
||||||
|
|
||||||
excludedirs += ../../../examples/widgets/doc
|
excludedirs += ../../../examples/widgets/doc
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
#include <QtWidgets>
|
||||||
|
#ifndef QT_NO_PRINTER
|
||||||
|
#include <QPrinter>
|
||||||
|
#include <QPrintDialog>
|
||||||
|
#endif
|
||||||
|
|
||||||
class Window : public QWidget
|
class Window : public QWidget
|
||||||
{
|
{
|
||||||
@ -48,14 +53,20 @@ public:
|
|||||||
Window() {
|
Window() {
|
||||||
myWidget = new QPushButton("Print Me");
|
myWidget = new QPushButton("Print Me");
|
||||||
connect(myWidget, SIGNAL(clicked()), this, SLOT(print()));
|
connect(myWidget, SIGNAL(clicked()), this, SLOT(print()));
|
||||||
|
myWidget2 = new QPushButton("Print Document");
|
||||||
|
connect(myWidget2, SIGNAL(clicked()), this, SLOT(printFile()));
|
||||||
|
editor = new QTextEdit(this);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
layout->addWidget(myWidget);
|
layout->addWidget(myWidget);
|
||||||
|
layout->addWidget(myWidget2);
|
||||||
|
layout->addWidget(editor);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void print() {
|
void print() {
|
||||||
|
#if !defined(QT_NO_PRINTER)
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
|
|
||||||
printer.setOutputFileName("test.pdf");
|
printer.setOutputFileName("test.pdf");
|
||||||
@ -73,12 +84,34 @@ private slots:
|
|||||||
|
|
||||||
myWidget->render(&painter);
|
myWidget->render(&painter);
|
||||||
//! [0]
|
//! [0]
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void printFile() {
|
||||||
|
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
|
||||||
|
//! [1]
|
||||||
|
QPrinter printer;
|
||||||
|
|
||||||
|
QPrintDialog dialog(&printer, this);
|
||||||
|
dialog.setWindowTitle(tr("Print Document"));
|
||||||
|
if (editor->textCursor().hasSelection())
|
||||||
|
dialog.addEnabledOption(QAbstractPrintDialog::PrintSelection);
|
||||||
|
if (dialog.exec() != QDialog::Accepted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//! [1]
|
||||||
|
editor->print(&printer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPushButton *myWidget;
|
QPushButton *myWidget;
|
||||||
|
QPushButton *myWidget2;
|
||||||
|
QTextEdit *editor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "main.moc"
|
||||||
|
|
||||||
int main(int argv, char **args)
|
int main(int argv, char **args)
|
||||||
{
|
{
|
||||||
QApplication app(argv, args);
|
QApplication app(argv, args);
|
||||||
@ -88,6 +121,3 @@ int main(int argv, char **args)
|
|||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "main.moc"
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
a QPrintDialog, allowing the user to specify the printer to use, paper size, and
|
a QPrintDialog, allowing the user to specify the printer to use, paper size, and
|
||||||
other printing properties.
|
other printing properties.
|
||||||
|
|
||||||
\snippet richtext/orderform/mainwindow.cpp 18
|
\snippet widgetprinting.cpp 1
|
||||||
|
|
||||||
It is also possible to set certain default properties by modifying the QPrinter
|
It is also possible to set certain default properties by modifying the QPrinter
|
||||||
before it is supplied to the print dialog. For example, applications that
|
before it is supplied to the print dialog. For example, applications that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user