Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.2, 5.2.1
-
Windows 7 + Qt4.8.2
-
071098b08b12fc1af6341ff6d7ba6713e5de1481 (5.3)
Description
The attached example application demonstrates the use case.
Use case:
Widget has some child widgets on the layout.
Render the widget into the QPicture.
Render the QPicture to the printer:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { widget = new QWidget; QGridLayout *layout = new QGridLayout(widget); layout->addWidget( new QRadioButton("Radio button"), 0,0 ); layout->addWidget( new QLabel("Label"), 0,1 ); layout->addWidget( new QPushButton( "Button 1" ), 1,0 ); layout->addWidget( new QPushButton("Button 2"), 1,1 ); setCentralWidget(widget); QTimer::singleShot(2000, this, SLOT(pic())); } void MainWindow::pic() { qDebug("MainWindow::pic()"); QPicture pic; widget->render(&pic); // render to QPicture QPrinter printer; printer.setOutputFileName( "test.pdf" ); QPainter painter(&printer); pic.play(&painter); // render QPicture to printer. }
Error: only the last added child widget is visible on the generated PDF.
Attachments
Issue Links
- is required for
-
QTBUG-37693 QtPrintSupport - Painting Issues
- Open
-
QTBUG-37713 QtPrintSupport - 5.3 issues
- Open
- resulted in
-
QTBUG-43968 [REGRESSION] QWidget::grab() ignores alpha and QGraphicsEffect
- Closed
For Gerrit Dashboard: QTBUG-26564 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
81617,1 | Make QWidget::render() work correctly with all paint devices | stable | qt/qtbase | Status: MERGED | +2 | 0 |
81626,1 | Make QWidget::render() work correctly with all paint devices | 4.8 | qt/qt | Status: ABANDONED | -1 | 0 |