MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / verticalScrollToValue

Method verticalScrollToValue

launcher/ui/instanceview/InstanceView.cpp:1018–1033  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016}
1017
1018int InstanceView::verticalScrollToValue([[maybe_unused]] const QModelIndex& index, const QRect& rect, QListView::ScrollHint hint) const
1019{
1020 const QRect area = viewport()->rect();
1021 const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());
1022 const bool below = (hint == QListView::EnsureVisible && rect.bottom() > area.bottom());
1023
1024 int verticalValue = verticalScrollBar()->value();
1025 QRect adjusted = rect.adjusted(-spacing(), -spacing(), spacing(), spacing());
1026 if (hint == QListView::PositionAtTop || above)
1027 verticalValue += adjusted.top();
1028 else if (hint == QListView::PositionAtBottom || below)
1029 verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1);
1030 else if (hint == QListView::PositionAtCenter)
1031 verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2);
1032 return verticalValue;
1033}

Callers

nothing calls this directly

Calls 2

rectMethod · 0.80
valueMethod · 0.80

Tested by

no test coverage detected