Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QAbstractScrollArea::setViewport ( QWidget widget  )  [inherited]

Since:
4.2 Sets the viewport to be the given widget. The QAbstractScrollArea will take ownership of the given widget.
If widget is 0, QAbstractScrollArea will assign a new QWidget instance for the viewport.

See also:
viewport()

Definition at line 497 of file qabstractscrollarea.cpp.

References QMetaObject::invokeMethod().

Referenced by QGraphicsView::QGraphicsView(), and QMdiArea::QMdiArea().

{
    Q_D(QAbstractScrollArea);
    if (widget != d->viewport) {
        QWidget *oldViewport = d->viewport;
        if (!widget)
            widget = new QWidget;
        d->viewport = widget;
        d->viewport->setParent(this);
        d->viewport->setFocusProxy(this);
        d->viewport->installEventFilter(d->viewportFilter);
        d->layoutChildren();
        if (isVisible())
            d->viewport->show();
        QMetaObject::invokeMethod(this, "setupViewport", Q_ARG(QWidget *, widget));
        delete oldViewport;
    }
}


Generated by  Doxygen 1.6.0   Back to index