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

void QWidget::scroll ( int  dx,
int  dy 
) [inherited]

Scrolls the widget including its children dx pixels to the right and dy downward. Both dx and dy may be negative.

After scrolling, the widgets will receive paint events for the areas that need to be repainted. For widgets that Qt knows to be opaque, this is only the newly exposed parts. For example, if an opaque widget is scrolled 8 pixels to the left, only an 8-pixel wide stripe at the right edge needs updating.

Since widgets propagate the contents of their parents by default, you need to set the autoFillBackground property, or use setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make a widget opaque.

For widgets that use contents propagation, a scroll will cause an update of the entire scroll area.

See also:
{Transparency and Double Buffering}

Definition at line 2128 of file qwidget_x11.cpp.

References QObject::children(), QWidget::rect, and QWidget::updatesEnabled.

Referenced by Q3ListView::handleSizeChange(), Q3ScrollView::moveContents(), and QGraphicsView::scrollContentsBy().

{
    Q_D(QWidget);
    if (!updatesEnabled() && children().size() == 0 || !isVisible())
        return;
    if (dx == 0 && dy == 0)
        return;
    d->scrollChildren(dx, dy);
    if (!QWidgetBackingStore::paintOnScreen(this)) {
        d->scrollRect(rect(), dx, dy);
    } else {
        scroll(dx, dy, QRect());
    }
}


Generated by  Doxygen 1.6.0   Back to index