Exemplo n.º 1
0
void AbstractScrollArea::setViewport(QGraphicsWidget *viewport)
{
    if (m_viewport) {
        m_viewport->setParentItem(0);

        QList<QGraphicsItem*> children = m_viewport->childItems();

        foreach (QGraphicsItem *child, children)
            child->setParentItem(0);

        delete m_viewport;
    }

    m_viewport = viewport;

    if (viewport) {

        m_viewport->setParentItem(this);
        m_viewport->setContentsMargins(0, 0, 0, 0);

        adjustScrollBars();
    }

    emit viewportChanged(viewport);
}
Exemplo n.º 2
0
bool AbstractScrollArea::event(QEvent *e)
{
    if (e->type() == QEvent::ApplicationLayoutDirectionChange
       || e->type() == QEvent::LayoutDirectionChange) {
    } else if (e->type() == QEvent::GraphicsSceneResize) {        
        QGraphicsSceneResizeEvent *event = 
            static_cast<QGraphicsSceneResizeEvent*>(e);

        QSizeF newSize = event->newSize();
        QRectF hrect = m_horizontalScrollBar->boundingRect();
        QRectF vrect = m_verticalScrollBar->boundingRect();

        QSizeF vpSize = newSize;

        if (m_horizontalScrollBarPolicy != Qt::ScrollBarAlwaysOff)
            vpSize.setHeight(newSize.height() - hrect.height());
        if (m_verticalScrollBarPolicy != Qt::ScrollBarAlwaysOff)
            vpSize.setWidth(newSize.width() - vrect.width());

        m_viewport->resize(vpSize);

        adjustScrollBars();
    }

    return QGraphicsWidget::event(e);
}
Exemplo n.º 3
0
void Player::resizeEvent(QResizeEvent*)
{
    MLT.onWindowResize();
    if (Settings.playerZoom() > 0.0f) {
        float horizontal = float(m_horizontalScroll->value()) / m_horizontalScroll->maximum();
        float vertical = float(m_verticalScroll->value()) / m_verticalScroll->maximum();
        adjustScrollBars(horizontal, vertical);
    } else {
        m_horizontalScroll->hide();
        m_verticalScroll->hide();
    }
}
Exemplo n.º 4
0
void WHotSpotList::resized( WOrdinal w, WOrdinal h )
//-----------------------
{
    int         newtop;

    WWindow::resized( w, h );
    newtop = count() - getRows();
    if( newtop < 0 ) newtop = 0;
    if( newtop < _topIndex ) {
        performScroll( newtop, TRUE );
    }
    adjustScrollBars();
}
Exemplo n.º 5
0
void WHotSpotList::reset()
//-----------------------
{
    adjustScrollBars();
    invalidate();
}