mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 00:31:02 +08:00
(EasyGraphicsView) Scroll to main thread after file load
This commit is contained in:
parent
02e43a2b45
commit
33bd7256ab
@ -518,6 +518,8 @@ void EasyGraphicsView::setTree(const ::profiler::thread_blocks_tree_t& _blocksTr
|
||||
m_pScrollbar->setMinimapFrom(longestItem->threadId(), longestItem->items(0));
|
||||
EASY_GLOBALS.selected_thread = longestItem->threadId();
|
||||
emit EASY_GLOBALS.events.selectedThreadChanged(longestItem->threadId());
|
||||
|
||||
scrollTo(longestItem);
|
||||
}
|
||||
|
||||
m_idleTimer.start(IDLE_TIMER_INTERVAL);
|
||||
@ -733,10 +735,7 @@ void EasyGraphicsView::onGraphicsScrollbarWheel(qreal _mouseX, int _wheelDelta)
|
||||
{
|
||||
if (item->threadId() == EASY_GLOBALS.selected_thread)
|
||||
{
|
||||
m_bUpdatingRect = true;
|
||||
auto vbar = verticalScrollBar();
|
||||
vbar->setValue(item->y() + (item->boundingRect().height() - vbar->pageStep()) * 0.5);
|
||||
m_bUpdatingRect = false;
|
||||
scrollTo(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -744,6 +743,14 @@ void EasyGraphicsView::onGraphicsScrollbarWheel(qreal _mouseX, int _wheelDelta)
|
||||
onWheel(_mouseX, _wheelDelta);
|
||||
}
|
||||
|
||||
void EasyGraphicsView::scrollTo(const EasyGraphicsItem* _item)
|
||||
{
|
||||
m_bUpdatingRect = true;
|
||||
auto vbar = verticalScrollBar();
|
||||
vbar->setValue(_item->y() + (_item->boundingRect().height() - vbar->pageStep()) * 0.5);
|
||||
m_bUpdatingRect = false;
|
||||
}
|
||||
|
||||
void EasyGraphicsView::onWheel(qreal _mouseX, int _wheelDelta)
|
||||
{
|
||||
const decltype(m_scale) scaleCoeff = _wheelDelta > 0 ? ::profiler_gui::SCALING_COEFFICIENT : ::profiler_gui::SCALING_COEFFICIENT_INV;
|
||||
|
@ -183,6 +183,7 @@ private:
|
||||
void updateVisibleSceneRect();
|
||||
void updateTimelineStep(qreal _windowWidth);
|
||||
void scaleTo(qreal _scale);
|
||||
void scrollTo(const EasyGraphicsItem* _item);
|
||||
void onWheel(qreal _mouseX, int _wheelDelta);
|
||||
qreal setTree(EasyGraphicsItem* _item, ::profiler::block_index_t _parent, const ::profiler::BlocksTree::children_t& _children, qreal& _height, qreal _y, short _level);
|
||||
|
||||
|
@ -120,15 +120,7 @@ void EasyGraphicsSliderItem::paint(QPainter* _painter, const QStyleOptionGraphic
|
||||
const auto br = rect();
|
||||
|
||||
qreal w = width() * currentScale;
|
||||
qreal dx = 0;
|
||||
|
||||
// if (w < 1.0)
|
||||
// {
|
||||
// dx = (w - 1.0) * 0.5;
|
||||
// w = 1.0;
|
||||
// }
|
||||
|
||||
QRectF r(dx + br.left() * currentScale, br.top() + INDICATOR_SIZE, w, br.height() - INDICATOR_SIZE_x2);
|
||||
QRectF r(br.left() * currentScale, br.top() + INDICATOR_SIZE, w, br.height() - INDICATOR_SIZE_x2);
|
||||
const auto r_right = r.right();
|
||||
const auto r_bottom = r.bottom();
|
||||
auto b = brush();
|
||||
|
Loading…
x
Reference in New Issue
Block a user