你看错了
void QWidget::render ( QPaintDevice * target, const QPoint & targetOffset = QPoint(), const QRegion & sourceRegion = QRegion(), RenderFlags renderFlags = RenderFlags( DrawWindowBackground | DrawChildren ) )
Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. Rendering starts at targetOffset in the target. For example:
QPixmap pixmap(widget->size());
widget->render(&pixmap);If sourceRegion is a null region, this function will use QWidget::rect() as the region, i.e. the entire widget.
Note: Make sure to call QPainter::end() for the given target's active painter (if any) before rendering. For example:
QPainter painter(this);
...
painter.end();
myWidget->render(this);This function was introduced in Qt 4.3.