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); }
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); }
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(); } }
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(); }
void WHotSpotList::reset() //----------------------- { adjustScrollBars(); invalidate(); }