mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
When opening a texture in raw buffer viewer, scroll to selected point
This commit is contained in:
@@ -375,23 +375,7 @@ void RDTableView::scrollTo(const QModelIndex &index, ScrollHint hint)
|
||||
// assume per-item vertical scrolling and per-pixel horizontal scrolling
|
||||
|
||||
// for any hint except position at center, we just ensure it's visible horizontally
|
||||
if(hint != QAbstractItemView::PositionAtCenter)
|
||||
{
|
||||
// scroll into view from the left
|
||||
if(dataRect.left() > cellRect.left())
|
||||
{
|
||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() -
|
||||
(dataRect.left() - cellRect.left()));
|
||||
}
|
||||
|
||||
// scroll into view from the right
|
||||
if(dataRect.right() < cellRect.right())
|
||||
{
|
||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() +
|
||||
(cellRect.right() - dataRect.right()));
|
||||
}
|
||||
}
|
||||
else
|
||||
if(hint == QAbstractItemView::PositionAtCenter)
|
||||
{
|
||||
// center it horizontally from the left
|
||||
QPoint dataCenter = dataRect.center();
|
||||
@@ -410,6 +394,14 @@ void RDTableView::scrollTo(const QModelIndex &index, ScrollHint hint)
|
||||
(cellCenter.x() - dataCenter.x()));
|
||||
}
|
||||
}
|
||||
else if(hint == QAbstractItemView::PositionAtTop)
|
||||
{
|
||||
horizontalScrollBar()->setValue(cellRect.left() - dataRect.left());
|
||||
}
|
||||
else if(hint == QAbstractItemView::PositionAtBottom)
|
||||
{
|
||||
horizontalScrollBar()->setValue(cellRect.right() - dataRect.right());
|
||||
}
|
||||
|
||||
// collapse EnsureVisible to either PositionAtTop or PositionAtBottom depending on which side it's
|
||||
// on, or just return if we only had to make it visible horizontally
|
||||
|
||||
Reference in New Issue
Block a user