-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracks view: keep current item visible when the view shrinks vertically #11273
Tracks view: keep current item visible when the view shrinks vertically #11273
Conversation
e48b754
to
34c3079
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
34c3079
to
038cbb0
Compare
Code looks is much better understandable now! |
The pre-commit failure is unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this nice addition. I have added some minor comments for improvement.
src/widget/wtracktableview.cpp
Outdated
} | ||
|
||
QModelIndex currIndex = currentIndex(); | ||
int rHeight = rowHeight(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved closer to usage.
I think it can become
'rowHeight(currRow)`
to make it work even if we have different row heights one day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used right below.
I looked at the Qt sources and noticed !currIndex.isValid()
can be replaced with currRow < 0 || rowHeight(currRow()) = 0
src/widget/wtracktableview.cpp
Outdated
// y-pos of the top edge, negative value means above viewport boundary | ||
int posInView = rowViewportPosition(currRow); | ||
// Check if the row is visible. | ||
// Note: don't use viewport()->height() because that may already have changed (??) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove (??)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
src/widget/wtracktableview.cpp
Outdated
return; | ||
} | ||
|
||
// TODO(xxx) When resizing, the top row is static, at least on Linux. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct and the TODO can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okido.
This PR is marked as stale because it has been open 90 days with no activity. |
This PR is marked as stale because it has been open 90 days with no activity. |
This still works good. Thank you. |
Just a small helper to fix an issue I had on my list for a long time:
if you toggle/expand a hidden/collapsed container (waveforms, effects, sampler) the track view shrinks which can push the track selection out of sight.
This commit makes sure it is pulled into view again if required.
Testing
Pick a track at the bottom of the view, and make sure there are some hidden skin regions to expand.
That track should reman visible both when showing a hidden region, as well as when manually (slowly) dragging the waveform splitter downwards.
Note: even though this handles the currentIndex (focused item, not the selection) this doesn't matter unless you use Ctrl + keys to move independent from the selection.